Unable to force unreal.EditorAssetLibrary.consolidate_assets()

I’m a rather experienced programmer, but I haven’t touched Python before, so I don’t know if the problem I have is related to the API itself or if it something about Python. I have about 6000 materials that i would like to consolidate to material instances that I already prepared.

I tried using this in my pipeline, unreal.EditorAssetLibrary.consolidate_assets()
Simplified version of the Code:


import unreal
asset=unreal.EditorAssetLibrary.load_asset('/Game/FirstPerson/AA2Assets/Textures/T_AA2_Misc/Roof/misc2_roof_shingle01_brown_Mat_Inst.misc2_roof_shingle01_brown_Mat_Inst')
material=unreal.EditorAssetLibrary.load_asset('/Game/FirstPerson/AA2Assets/Textures/T_AA2_Misc/Roof/misc2_roof_shingle01_brown_Mat.misc2_roof_shingle01_brown_Mat')
materials=[material]
result=unreal.EditorAssetLibrary.consolidate_assets(asset,materials)


i get:
LogEditorScripting: Error: ConsolidateAssets. The object ‘misc2_roof_shingle01_brown_Mat’ doesn’t have the same class as the AssetToConsolidateTo.
Is it impossible to use this to consolidate a Material to a Material Instance, or am I just using it wrong?

I’ve done the work manually now, so i don’t need the info anymore.

Same problem here, it seems to be possible in the editor https://answers.unrealengine.com/que…-instance.html
Also Materials are exception to the limitation to be the same class: Consolidating Assets in Unreal Engine | Unreal Engine Documentation
So it should be possible with python… maybe casting the instance to material class?