What is the correct way to run a script internally stored in the blend file from the CLI?

I'm trying to run a script I have in the text editor. I have it named "Import" in the text editor. The -P parameter seems to be made for externally stored scripts and doesn't work when I try to use it like this blender -b file.blend -P Import.

I would prefer to leave the script in the blend file. But if necessary I can move it out.

I've read that you can start a script when you load a blend file but that won't work for me. I am setting up a video render server where I will be importing video files into the VSE and generating proxy files from the "Import" script. The proxy render takes a long time so I am looking to offload that to the server. I will then be downloading the blend file and proxy files to another computer to do editing.


1 Answer 1


Run blender --help and look for any option with 'Python' in the name. You'll find that it's blender filename.blend --python-text Import.

Alternatively, name your script yourscript.py (so end it in .py), and you can enable the "Register" checkbox to automatically run the script whenever you load the blend file. This can be easier, depending on your needs.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .