I'm wondering if there's a way of telling blender which camera to use as the active one when rendering from the command line. I can't seem to find any documentation about this.

Also there is no mention of this feature in the manual:

Note: I also want to be able to render multiple cameras from a single .blend file. This will allow me to solely reconfigure my .bat file without having to go back and forth in my .blend files.

System information:
Windows 8.1
Blender 2.78a
Cycles render engine


1 Answer 1


You can set your camera in a textblock in your blend file text editor using

import bpy
bpy.context.scene.camera = bpy.data.objects["Camera"]

then call run your .blend file from the command line and run this textblock as shown below:

blender --background myfile.blend --python-text Text

where myfile.blend is your blend file and Text is your textblock name and --background is an argument to run your .blend file in the background without opening blender GUI

If you want to set a specific camera without having to go back and forth then you can pass the camera name you want in your command line as shown here

  • $\begingroup$ Thank you for your answer, however this is not really what I'm looking for. This workflow does not allow me to configure multiple cameras to render in one .blend file. I'll add this to my question. $\endgroup$
    – Delagone
    Mar 15, 2017 at 10:35
  • $\begingroup$ @Delagone answer modified so you can pass the camera name as an argument with your command line $\endgroup$
    – Tak
    Mar 15, 2017 at 10:54

You must log in to answer this question.

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