How do I set an editor property to a texture using Python?

I can set a text property just fine. For example blueprint_class_default.set_editor_property(“Name”,“Tesy”)

But the Heightmap property accepts a texture file. I have already imported a texture file called alphabrush and can manually set Heightmap to this texture. However, when I try to do it in code it fails.

Here is a picture of the Heightmap property in the editor. I want to set this property to an existing texture via Python.

Current code that does not work.

# get the generated class
blueprint_generated = unreal.EditorAssetLibrary.load_blueprint_class(out_asset)

# from that, get the class default object ( the actual template for the blueprint )
blueprint_class_default = unreal.get_default_object(blueprint_generated)

# set or get properties

blueprint_class_default.set_editor_property("HeightMap", "/Game/Brushes/CustomBrushes/Textures/alphabrush")
unreal.EditorAssetLibrary.save_asset(out_asset)
1 Like

I figured it out. I just needed to load the texture file.

texture = unreal.EditorAssetLibrary.load_asset(“/Game/Brushes/CustomBrushes/Textures/alphabrush”)

blueprint_class_default.set_editor_property(“HeightMap”, texture)
1 Like