Prevent Editor from exiting when running from command line with -ExecutePythonScript

Two solutions for you:

  1. Prevent Editor to exit on Python script compete in UE5.5:
    unreal.EditorPythonScripting — Unreal Python 5.5 (Experimental) documentation
    unreal.EditorPythonScripting.set_keep_python_script_alive(True)
    Then subscribe Python function for Tick() and you may check for you job complete:
    unreal — Unreal Python 5.5 (Experimental) documentation
    unreal.register_slate_pre_tick_callback(callback_editor_tick)

  2. For Movie Render Pipeline use embedded cmd parameters:
    Command Line Rendering With Unreal Engine Movie Render Queue | Community tutorial
    Example:
    "C:\Program Files\Epic Games\UE_4.26\Engine\Binaries\Win64\UE4Editor.exe" "D:\MyProject\MyProject.uproject" "/Game/Levels/MyLevel" -MovieSceneCaptureType="/Script/MovieSceneCapture.AutomatedLevelSequenceCapture" -LevelSequence="/Game/Sequencer/MySequencer" -MovieFolder="D:\Output" -Game -RenderOffScreen -Unattended -NoLoadingScreen -NoScreenMessages -NoTextureStreaming -ResX=1920 -ResY=1080 -ForceRes -MovieFrameRate=25 -MovieFormat=PNG -MovieQuality=100 -MovieName="{world}.{frame}" -MovieCinematicMode=Yes -MovieWarmUpFrames=1 -MovieDelayBeforeWarmUp=0 -MovieStartFrame=0 -MovieEndFrame=100