That’s it really… I have a super simple addon framework set up. I have a debug print that works- I go change the text and call Reload Scripts and the old debug print still shows up. I have to shut down Blender and restart every single time to see my changes. What am I missing?
single .py or has local imports?
local imports, the text changes that are happening is in the locally imported file as well
Welll not sure how your file is structured but this is the general logic for reloading
if "bpy" in locals(): #means Blender already started once
import importlib
importlib.reload(mylib)
else: #start up
from . mylib import *
Yeeeppp that was it. I had forgotten that Blender needed that extra step for local re-importing. It’s been a while. Thanks a ton!
No problem, I was confused with it back then too. it makes sense now.
Hell sir,
I’m starting to learn blender python can you please describe how to reload scripts I tried the code from “solution” and i didn’t know how to run it appropriately( without an error)
I made simple ui addon and testing. I’m reloading externally saved script with blender’s “reload scripts” operator. but no updates are noticed. When i remove and reinstall the addon, They its showing.
Please help.
I guess that depends on how you structured it. The solution above generally works when all the modules are in the same folder as the __init__.py
The solution with reloading the local module works but what if I have bunch of modules inside that modules that need to be reimported too?
Guess the only way to solve this is to reload each module too.
In development you work only with few modules and it’s not a big deal to add to just add a reload statement for them but it’s still requires some attention.
Important thing to mention - import bpy should happen AFTER this code otherwise "bpy" in locals() will always be True and code won’t work.