Local modules don’t update
-
Hi Drawbot team,
I have recently started with DrawBot and came across a problem with importing local modules. I am trying to reuse some code within different DB scripts (without making it a PyPI package). Here is my file structure:
myProject
-__init.py__
-main.py
-DBlib
--__init.py__
--utils.pyHere is the top of myProject/main.py:
from DBlib.utils import *
This works, however when running myProject/main.py DrawBot app does not seem to detect changes in myProject/DBlib/utils.py until I restart the app and re-run myProject/main.py. Is there something I am doing wrong with importing my local module?
Thanks!
Maciej
-
To update the contents of a module, you need to reload it
-
reload
is python 2
afaik in python 3.4 and newer you are supposed to use:import importlib importlib.reload(module)
good luck!