Movie Graph Editor Python from CMD Line

I have lightly modified MovieGraphEditorExample.py to pass in my own queue and graph uassets. This works fine in an interactive Editor session. However, I cannot figure out how to get this to launch from the Command Line.

I have tried using UnrealEditor-Cmd.exe and passing my modified Python script as both -run=pythonscript and -ExecutePythonScript, which seems to begin rendering according to the log before immediately shutting down with no errors or warnings.

What is the right way to do this?

Steps to Reproduce

  1. Copy the MovieGraphEditorExample.py to MyProject/Content/Python/MyMovieGraphEditor.py
  2. Add render_queue(unreal.load_asset(“/Game/Cinematics/Sequences/MyRenderQueue.MyRenderQueue”), unreal.load_asset(“/Game/Cinematics/MyRenderGraph.MyRenderGraph”)) at the bottom of the py file.
  3. In an interactive session, import MyMovieGraphEditor
  4. Observe the render happens as expected.
  5. From command line, run C:\Program Files\Epic Games\UE_5.5\Engine\Binaries\Win64\UnrealEditor-Cmd.exe -ExecutePythonScript=C:\MyProject\Content\Python\MyMovieGraphEditor.py
  6. See this in the log

[2025.04.01-20.57.21:764][ 3]LogMovieScene: Starting new camera cut: ‘Shot1_Baked_0’

[2025.04.01-20.57.21:795][ 3]LogMovieRenderPipeline: MovieGraph Finished initializing Camera Cut [1/1] OuterName: [LST01_010] InnerName: Shot1_Baked.

[2025.04.01-20.57.22:751][ 3]LogContentStreaming: Texture pool size now 3000 MB

[2025.04.01-20.57.22:751][ 3]LogCsvProfiler: Display: Metadata set : streamingpoolsizemb=“3000”

[2025.04.01-20.57.23:248][ 3]Cmd: QUIT_EDITOR

[2025.04.01-20.57.26:516][ 3]LogMovieRenderPipeline: MovieGraph Finished rendering last shot. Moving to Finalize to finish writing items to disk.

[2025.04.01-20.57.26:535][ 3]LogPython: on_queue_finished_callback Render completed. Success: False

[2025.04.01-20.57.26:535][ 3]LogMovieRenderPipeline: Movie Graph Render completed. Duration: +00:00:05.158

[2025.04.01-20.57.26:535][ 3]LogMovieRenderPipeline: MoviePipelinePIEExecutor: Stalling finished, pipeline has shut down.

[2025.04.01-20.57.26:593][ 3]LogSlate: Updating window title bar state: overlay mode, drag disabled, window buttons hidden, title bar hidden

[2025.04.01-20.57.26:593][ 3]LogWorld: BeginTearingDown for /Game/Maps/UEDPIE_0_Cinematic

[2025.04.01-20.57.26:593][ 3]LogSlate: Window ‘Movie Pipeline Render (Preview) [Job 1/1 Total] Current Job: 0% Completed.’ being destroyed

[2025.04.01-20.57.26:601][ 3]LogWorld: UWorld::CleanupWorld for Cinematic, bSessionEnded=true, bCleanupResources=true

[2025.04.01-20.57.26:601][ 3]LogSlate: InvalidateAllWidgets triggered. All widgets were invalidated

[2025.04.01-20.57.26:601][ 3]LogWorldPartition: UWorldPartition::Uninitialize : World = /Game/Maps/UEDPIE_0_Cinematic.Cinematic

[2025.04.01-20.57.26:605][ 3]LogPlayLevel: Display: Shutting down PIE online subsystems

I managed to get this all working by invoking a full interactive editor session and running a startup Python script that looks for a render config file to see if any rendering should be performed. In the finished callback for the queue, I use unreal.SystemLibrary.execute_console_command(None, “QUIT_EDITOR”) to close the editor.

Am I missing anything? It seems this is the only way to get Movie Render Graph working with Python automation, as the Python-based runtime Executor only works with -game and MRG isn’t supported in -game, while running via -ExecutePythonScript has the aforementioned problem of shutting down immediately and not waiting for any callbacks. Ultimately it would be more convenient if I could pass arguments directly to the script with -ExecutePythonScript instead of reading a config file from disk, but this works for now.

Thanks for any input!

Hey Jesse, you need to add a magic method to keep the editor running, have a look at this tutorial here.

unreal.EditorPythonScripting.set_keep_python_script_alive(True)

I don’t know how I missed this page! I’ll give this a try and respond only if it doesn’t work for some reason. Thanks so much!