Can you edit a Blueprint Variable from Python?

You can, but you need to set them on the Class Default Object (CDO) of the Blueprint Generated Class (BPGC), rather than the Blueprint asset itself (which is just a definition of how to build the BPGC). This requires the Blueprint asset itself to be compiled and up-to-date:


# get the generated class of the Blueprint (note the _C)
bp_gc = unreal.load_object(None, "/Game/MyBP.MyBP_C")
# get the Class Default Object (CDO) of the generated class
bp_cdo = unreal.get_default_object(bp_gc)
# set the default property values
bp_cdo.set_editor_property("MyFloatProp", 1.0)
bp_cdo.set_editor_property("MyBoolProp", True)

6 Likes