Python issues

I wanted to share with everyone my struggle to get Python working in Unreal 4. This is where I am at and I am looking to make Epic aware of what is not working.

  • Open Unreal 4.20.2
  • Load the map into the editor Minimal_Default that ships with Unreal
  • Load the Python Editor Script Plugin


Switch to the Python command line in the Output Log:

Select a few objects in the scene. Here I selected the table and chair.

Next copy and paste and execute each of these chunks of code. You have to do it in chunks because the input lines are limited to 10 max I think.

import unreal
level_path = '/Game/StarterContent/Maps/Minimal_Default'
level = unreal.find_asset(name=level_path)
selectionIter = unreal.SelectedActorIterator(level)
selectionNames = ]

while True:
                node = None
                try: node =
                except: break

                # get node data
                nodeName = node.get_name()

print 'Selected nodes in scene = ', selectionNames

The result of these three chunks will show this in the log:


The log will print that you have the Table and Chair selected! Nice!

Now execute this line of code:

print help(unreal.SelectedActorIterator)


This will show you what methods are available to SelectedActorIterator. Many of the help documentation looks like it is still being setup so this is not necessarily ever function available to you.

Now execute this line of code:

print help(unreal.EditorStaticMeshLibrary)


Uh oh! What happened! It looks like the tutorials that are listed in the Unreal documentation show functions that do not yet exist inside of the Python unreal module.


The documentation shows this code:

 import unreal  asset_path = "/Game/studio"  # we define a function that generates new LODs for a specified Static Mesh Asset. def apply_lods(static_mesh):      # check if the mesh is complex enough.     number_of_vertices = unreal.EditorStaticMeshLibrary.get_number_verts(static_mesh, 0) 

However EditorStaticMeshLibrary does not exist as I showed above.


Hey Ryan,
the EditorStaticMeshLibrary is available in the EditorScriptingUtilties plugin. If you install that plugin for your project, you should get access to that class.

As that doc page says:

Prerequisite: If you haven’t already done so, you’ll need to install the Editor Scripting Utilities Plugin. For details, see Scripting and Automating the Editor.

Also, FYI, we’ve published a browsable, autogenerated version of the API docs at:

Hope that helps.