0
$\begingroup$

I'm currently trying to create a python script that allows me to render multiple .blend files with multiple rendering options at once and in the non-GUI mode.

So far I have the python script to run blender with another python script:

import os
os.system('cmd /k "blender -b python.blend1 -P Demos.py"')

and a proper python script to execute everything in python (for test purposes it just adds a cube and saves)

import bpy

bpy.ops.mesh.primitive_cube_add()
bpy.ops.wm.save_mainfile()

For the convenience of synchronizing those two programs and using the same variables in both of them, is there an option to combine this operation into a single python script? Something like opening a non-GUI blender instance from python, running commands inside this instance just like in blender's python interactive console, after finishing the job closing this instance and moving on to the next one? The interactions with Blender are in half outside it and the other half inside only via API commands, so it'd be nice to have a way to connect them and some variables.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.