Python: how to get path to object in world outliner

Hi,

I’m trying to check if an object exists in the world outliner via python script.

get_actor_reference (path_to_actor) seems to be the command that I need, but I do not know how to get the path to the actor when it is in the world outliner. In the Content Browser, I can just right click and copy the path, but not so in the world outliner.

Thanks,

eas = unreal.get_editor_subsystem(unreal.EditorActorSubsystem)
actor_ref = eas.get_actor_reference(path_to_actor)

in ue4, a simple way is hovering the mouse cursor on the object ui in outliner, it will display id name
then, use “/Game/your_map_name.your_map_name:PersistentLevel.your_object_id_name”

in ue5, you could use eas.get_all_level_actors() to get all actor references and select what you need, as well as in ue4