-
Book Overview & Buying
-
Table Of Contents
Python Scripting in Blender
By :
When a module is imported, Python caches a copy of it for future access. Since the __init__.py file is the only one to be updated by the Reload Scripts operator, we are left with two options:
reload function inside __init__.pyThe latter is preferred over restarting the application as it takes less time. The reload function is part of the importlib module.
The utilities contained in the importlib library interact with the import system, and the reload function forces the Python interpreter to reload a module from disk.
If the img_loader module has changed and needs to be reloaded, we can use the following command:
from importlib importreloadreload(img_loader)
So, to make sure that the changes to our add-on .py files are always applied, we can add these lines of code to _init_.py:
from . import img_loader from . import panel from importlib import reload...