# Fix redirectors via python.

**URL:** <https://forums.unrealengine.com/t/fix-redirectors-via-python/124785>\
**Category:** Editor Scripting\
**Tags:** unreal-engine\
**Created:** [April 10, 2019, 9:49pm UTC](https://forums.unrealengine.com/t/fix-redirectors-via-python/124785 "2019-04-10T21:49:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Ape\_Jelly](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mr\_Ape\_Jelly](https://forums.unrealengine.com/u/Mr_Ape_Jelly)\
**Post date:** [April 10, 2019, 9:49pm UTC](https://forums.unrealengine.com/t/fix-redirectors-via-python/124785/1 "2019-04-10T21:49:47Z")

</div>

Is there a way to fix up redirectors via python? Did a search for redirectors and came up with nothing useful.

---

<div class="post-metadata">

**Author:** ![kakyoism](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kakyoism](https://forums.unrealengine.com/u/kakyoism)\
**Post date:** [April 19, 2019, 9:56am UTC](https://forums.unrealengine.com/t/fix-redirectors-via-python/124785/2 "2019-04-19T09:56:38Z")

</div>

+1. I have the same question.

---

<div class="post-metadata">

**Author:** ![kakyoism](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kakyoism](https://forums.unrealengine.com/u/kakyoism)\
**Post date:** [April 19, 2019, 11:22am UTC](https://forums.unrealengine.com/t/fix-redirectors-via-python/124785/3 "2019-04-19T11:22:22Z")

</div>

@anonymous_user_6090db57 have you tried

```auto

 unreal.AssetTools.rename_assets() 

```

and

```auto

unreal.AssetRenameData

```

.

I haven’t, but they look promising. Nothing is mentioned about redirecting with those, so I hope they will work that out for you.

---

<div class="post-metadata">

**Author:** ![kakyoism](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@kakyoism](https://forums.unrealengine.com/u/kakyoism)\
**Post date:** [April 19, 2019, 11:33am UTC](https://forums.unrealengine.com/t/fix-redirectors-via-python/124785/4 "2019-04-19T11:33:01Z")

</div>

so I found a faint clue:

```auto

unreal.AssetData.is_redirector() 

```

tells me that redirector is an asset itself. However, this makes me think that with Python scripting, redirection may not be as straightforward as it looks in the Editor: You would work through a bunch of “secondary” redirector assets to fix other assets. So some associations must be made bottom-up. Seems a daunting task to me…

---

<div class="post-metadata">

**Author:** ![zapan669](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@zapan669](https://forums.unrealengine.com/u/zapan669)\
**Post date:** [June 26, 2024, 6:56pm UTC](https://forums.unrealengine.com/t/fix-redirectors-via-python/124785/5 "2024-06-26T18:56:55Z")

</div>

any update with this ?

---

<div class="post-metadata">

**Author:** ![dpotuznik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dpotuznik](https://forums.unrealengine.com/u/dpotuznik)\
**Post date:** [August 5, 2024, 7:18am UTC](https://forums.unrealengine.com/t/fix-redirectors-via-python/124785/6 "2024-08-05T07:18:17Z")

</div>

Hi everyone,

i found this

> <https://github.com/20tab/UnrealEnginePython/issues/712>
>
> as title. Moving and renaming assets in Content Browser must be followed by a Fi…x up Redirectors in Folder op when done by hand. Is there an equivalent Python API?

i needed to change I little the python script but it work for me

you need to create a simple plugin C++ to add the functionality to python

here the python updated

```auto
    #https://github.com/20tab/UnrealEnginePython/issues/712
    def fix_up_all_redirections(self):
        redirectors = []
        lst = unreal.EditorAssetLibrary.list_assets('/Game/', True, True)
        for path in lst:
            path = path.split(".")[0]
            if unreal.EditorAssetLibrary.does_directory_exist(path):
                continue
            if unreal.EditorAssetLibrary.does_asset_exist(path):
                asset_data = unreal.EditorAssetLibrary.find_asset_data(path)
                asset_class = str(asset_data.asset_class_path.asset_name )
                if (asset_class == 'ObjectRedirector'):
                    redirectors.append(path)

            
        redirector_list = [redirector for redirector in redirectors]
        print(redirector_list)
        unreal.LayeredMaterialLibrary.fixup_referencers(redirector_list)

```

BTW  
Don’t forget to save everything after fix-up otherwise you lose all links after restart  
unreal.EditorAssetLibrary.save\_directory(‘/Game/’, False, True)

have a nice day.
