0
$\begingroup$

Backstory: I have a couple of .blend files that share a single python plugin that provides a custom operator that renders them. I also have a wrapper script that I run blender with that calls that operator, like this:

# wrapper.py
import bpy
bpy.ops.render.my_custom_render_operator()

then execute blender like this:

blender "$1.blend" --background --python wrapper.py

Each .blend file has the python plugin as an external text block that is automatically registered on startup.
My problem that when I edit the plugin file blender don't update it's copy. If I were opening the GUI I would would open the text block and go to Text->Reload (or ALT-R), but I can't do that when rendering from the command line.
I need a way to reload all the text blocks from python, so I could put that in wrapper.py before calling my operator. I couldn't find a function to do that, although bpy.ops.text.resolve_confit() looks close.

$\endgroup$
2
$\begingroup$

Auto-run text blocks execute before --python code, so nothing you put in wrapper.py will be able to reload the text block before the text gets auto-run.

I would disable auto-run (-Y) and either execute your file with exec in wrapper.py, or (better) just install it as a regular addon.

$\endgroup$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.