How to add component to existing actor in level with Python/Blueprint?

Thanks Ben for the blueprint snippets - they work as expected :smiley:

But when I try convert the BP into python the component doesn’t seem to get attached. Can you tell what I’m doing wrong?

so_subsystem = unreal.get_engine_subsystem(unreal.SubobjectDataSubsystem)  
for actor in unreal.VRScoutingInteractor.get_selected_actors():
    root_sub_object = so_subsystem.k2_gather_subobject_data_for_instance(actor)[0]
    new_sub_object = so_subsystem.add_new_subobject(unreal.AddNewSubobjectParams(
        parent_handle=root_sub_object,
        new_class=unreal.PointLightComponent,
    ))
    print(f"created {new_sub_object}")

# LogPython: created (<Struct 'SubobjectDataHandle' (0x000008ED0C7C12D0) {}>, Text(""))
3 Likes