When I try running my script using
UE4Editor-Cmd.exe -run=pythonscript -script="c:\my_script.py"
I get the following error:
I tried following the documentation here but had no luck: Scripting the Unreal Editor Using Python | Unreal Engine 5.1 Documentation.
Has anyone had any success running their python script from the command line?
You need to enable the Python plugin for the engine to load by default.
edit the PythonScriptPlugin.uplugin under “Engine\Plugins\Experimental\PythonScriptPlugin” and change the following to
“EnabledByDefault” : true,
Once you do that the “pythonscript” commandlet will load.
Update: You will also want to enable the EditorScriptingUtilities plugin by default as well…to get access to things like “unreal.EditorAssetLibrary”
“Engine\Plugins\Editor\EditorScriptingUtilities\EditorScriptingUtilities.uplugin” and change “EnabledByDefault” : true,