I am trying to parallelize rendering using blender's python API, built as a python module. I'd like to use multiple instances of blender contained within their own classes. Currently, I can generate multiple instances by running a script multiple times, but cannot have two functioning instances of the class in the same script, due to how bpy uses import to initialize the blender instance. Is there a way to get around this? A cut down version of the class is below.
class BpyRenderer(object):
import bpy
def __init__(self):
self.bpy.ops.wm.open_mainfile(filepath='blank.blend')
def render(self, filename):
self.bpy.data.scenes['Scene'].render.filepath = filename
self.bpy.ops.render.render( write_still=True )