I have 2 self-defined packages pac1
and pac2
. I used to import all the modules one by one and reload them one by one after change, like so:
from pac1 import mod1
from pac1 import mod2
from pac1 import mod3
from pac2 import mod4
from pac2 import mod5
reload(mod1)
reload(mod2)
reload(mod3)
reload(mod4)
reload(mod5)
Now, I learn that I can batch import the modules and improve the codes to:
from pac1 import *
from pac2 import *
reload(mod1)
reload(mod2)
reload(mod3)
reload(mod4)
reload(mod5)
But is this the best I can do? I mean can I reload all the packages in one go?
UPDATE1: I am constantly modifying these modules. So after importing them at the start of the testing, I may need to frequently reload the modified modules to reflect the changes. This is the incentive for me to reload the modules.
UPDATE2: This process is not necessarily done dynamically. I just want to make my code more concise by fusing all those reload()
into one.