# How do I get a python script to run after the .blend file loads from the command line?

I am using this command line:

blender -P test.py test.blend


and test.py has:

import bpy
for scene in bpy.data.scenes:
scene.render.image_settings.file_format = "FFMPEG"


If I run with just this command line:

blender -P test.py


the file format is set just fine. But if I put the blender file back in the command line, the file format is not changed. My interpretation is that the .py file is run before the .blend file is loaded. Whether or not my interpretation is correct, how can I make this happen the way I want it to?

Additional information: This is a stand-along render server for high school students and I need to ensure that a number of things are set correctly and not just the file format.

blender test.blend -P test.py