Adding Blueprint component to StaticMeshActor via Python

Hi,

I have a scene with around 4000 actors that I want to attach a blueprint actor component to them. The manual way of using the add button and adding the BPC works fine, I am now trying to automate and add to all of them via python.

Below is my script:

###START HERE###   

import unreal

# Specify the Blueprint component class you want to add
blueprint_component_class = unreal.load_class(None, "/Game/02_BP/Clickable/BPC_Clickable_0820.BPC_Clickable_0820_C")

# Get the selected actors in the Outliner
selected_actors = unreal.EditorLevelLibrary.get_selected_level_actors()

if not selected_actors:
    unreal.log_warning("No actors selected in the Outliner. Please select actors.")
else:
    # Iterate through the selected actors
    for actor in selected_actors:
        # Check if the actor is a StaticMeshActor
        if isinstance(actor, unreal.StaticMeshActor):
            # Print the display name of the StaticMeshActor
            display_name = actor.get_actor_label()
            unreal.log(f"Selected StaticMeshActor: {display_name}")
            
            # Add the specified Blueprint component to the StaticMeshActor
            component = unreal.Actor.attach_to_actor (actor, 0,0,0,"blueprint_component_class.get_name()", blueprint_component_class)
            unreal.log(f"Added {blueprint_component_class.get_name()} to {display_name}.")

unreal.log("Finished processing selected StaticMeshActors.")

### END OF SCRIPT ###

I am getting this error log:
[74833.94][788]LogPython: Error: Traceback (most recent call last):
[74833.94][788]LogPython: Error: File “”, line 21, in
[74833.94][788]LogPython: Error: TypeError: StaticMeshActor: Failed to convert parameter ‘parent_actor’ when calling function ‘Actor.K2_AttachToActor’ on ‘StaticMeshActor_UAID_00■■■40113C795D901_1447373600’
[74833.94][788]LogPython: Error: TypeError: NativizeProperty: Cannot nativize ‘int’ as ‘ParentActor’ (ObjectProperty)
[74833.94][788]LogPython: Error: TypeError: NativizeObject: Cannot nativize ‘int’ as ‘Object’ (allowed Class type: ‘Actor’)

Am I missing something? Is there another command that I can use to attach blueprint component to static mesh actor?

Kind Regards,