Keep imported python module "fresh" -


ok, have following question:

i have following: x.py:

from y import afunc 

y.py:

from z import adict 

now, x runs on run,sleep,repeat schedule. calls afunc on files. afunc uses values in adict , returns.

adict in python module managed user in econ department. understand import called once , cached. if put import statement inside afunc it'll still imported once , cached (please correct me if i'm wrong).

but want able pick changes adict on fly, in other words, i'd re-import z.adict every time x called y.afunc

any advice appreciated!

you can use reload can't use

from z import adict 

you can :

reload(z) #do z.adict here 

Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -