[Python] get current folder name in World Outliner

Hello, @Pilo_Gustinman

To get the folder name of a selected item in Unreal’s World Outliner using Python:

Python

import unreal

Get the selected actors

selected_actors = unreal.EditorUtilityLibrary().get_selected_actors()

Check if any actors are selected

if selected_actors:
# Get the folder path of the first selected actor
folder_path = selected_actors[0].get_folder_path()

# Extract the folder name
folder_name = folder_path.split('/')[-1] if folder_path else 'No Folder'

print(f"Folder: {folder_name}")

Hope this info will help you.
Best Regard,
geraldine198