Change component variables on Blueprint class via Python

Hi, I’m stuck on trying to get the components of a blueprint actors default class, I can set the base properties with no problem - its then accessing the child components. Also get_component_by_type doesnt seem to work the way I am using it.



import unreal
#get blueprint asset
blueprint = unreal.load_object(None, '/Game/Blueprints/Character.Character_C')
bp_cdo = unreal.get_default_object(blueprint)

#define skeletal mesh
SM = '/Game/Meshes/CharMesh.CharMesh'
Masset = unreal.load_asset(SM)

bp_cdo.set_editor_property("Mesh", SMasset)

print bp_cdo.get_editor_property("Mesh")


This works fine, problem is I dont want to set a ‘mesh’ variable on the actor, I want to set it on the Skeletal Mesh Component.
I attempt to get the skeletal mesh component using

component = bp_cdo.get_component_by_type(‘SkeletalMeshComponent’)

and I know this will work if i have an actor already loaded - but i am completely lost on how to access the components of a base blueprint class?|

Any help would be greatly appreciated, a day of checking UnrealSlackers discord, Unreal Answers and Forum posts have given me nothing

Did you find a solution?

Components are not contained in CDO, but in USimpleConstructionScript. See How to get a component from a ClassDefaultObject?