I have two modules that work together.
For example, I have user.py and email.py. user.py have a function to verify a register and email.py have a function to send a email of confirmation. I import in controller user.py, and user.py import email.py.
with:
from gluon.custom_import import track_changes
track_changes(True)
I detect changes in user.py, but not in email.py. I tried to put track_changes
also in user.py and it doesn't work.
Are there something that I can do without restart server/web2py?
Web2Py: 2.16.1-stable+timestamp.2017.11.14.05.54.25 (I try with *.exe and *.py)
OS: Windows 10 Pro
Thanks!
web2py uses a custom importer that first attempts to import a module via the standard Python built-in method and then looks in the application's /modules folder only if the built-in method fails. Only modules found via this custom import process are trackable.
Because user.py has already been imported and email.py is in the same folder as user.py, the Python built-in import method knows to look in the same folder for the email
module when it encounters import email
within the user.py file. As a result, the web2py custom import process does not kick in, and the module is therefore not tracked.
I suppose this behavior could be changed, but for now, that's how it works, so your second import will not be tracked.