Python Save MultiLayer EXR BUG? I am currently writing a script that should render out each render layer via:

bpy.ops.render.render(layer=“InsertRenderLayerNameHere”)


and then save the resulting image. The problem is that when I do:

bpy.data.images[“Render Result”].save_render(“InsertFilePathHere”,scene=bpy.data.scene[0])


and I have the scene file format set to OpenExr Multilayer, the image still only gets saved as a normal/flat openexr file. This is probably a bug right?

The even weirder thing is that then I open a OpenExr Multilayer file in Blender and then go:

bpy.data.images[“OpenExr_Test_File.exr”].file_format 


python outputs : “’PNG”

Thanks in advance for any answers
You can add a File output Node, then add as many sockets as you need in your multilayer EXR, and connect them to your renderlayer sockets node:  

renderlayers_node = scene_tree.nodes.new('CompositorNodeRLayers')
outputfile_node = scene_tree.nodes.new('CompositorNodeOutputFile')
outputfile_node.format.file_format = 'OPEN_EXR_MULTILAYER'  # 'OPEN_EXR'
outputfile_node.base_path = base_path
outputfile_node.file_slots.new('Z')
scene_tree.links.new(renderlayers_node.outputs['Image'], outputfile_node.inputs['Image'])
scene_tree.links.new(renderlayers_node.outputs['Z'], outputfile_node.inputs['Z'])