I want to achieve following functionality using python in blender -
- I want to open blender files located at a given path.
- Change textures of some objects in that blender file
- Set angle of the camera
- Render the scene and save the render at a given location. This will go in a loop for many blender scenes with proper lighting.
From above points I have achieved all points. But my problem is when i open a blender file using following script -
obj_root = pathlib.Path("I:/PythonBlender/first.blend") bpy.ops.wm.open_mainfile(filepath= str(obj_root))
the old file running the python scripts is closed and this new first.blend file is opened in blender. I want my python scripts to keep running and the scenes should load as an addon. and remove the addon scenes after rendering is finished. I also want to know what approach you will follow to achieve the above functionality with proper memory management and loading, unloading of textures and other files after rendering is done.