Python module cache?

Python module cache?

Anonymous
Not applicable
889 Views
0 Replies
Message 1 of 1

Python module cache?

Anonymous
Not applicable

I am working on a PySide dialog for 3DS Max and am having trouble with module importing. From my main .py file I import a module from a sub-directory which seems to work okay. However when I make changes to this module and re-run my python file 3DS  Max somehow doesn't see these changes and I need to restart Max before they take effect.

 

EDIT

Okay I did not realize that it is actually a python idiom to not re-import modules if they are already in the namespace, which would explain this issue. Now that said I added  reload(MODULE) right after my import statement to force python to reload the module and this is still not working

 

import sys
sys.path.append("path to module root dir") # needed to import the module, which is not set in the PYTHONPATH env variable
import MaxCI
reload(MaxCI)

MaxCI.test_def() # this throws an error if it was not in the module before the first time the script is run
0 Likes
890 Views
0 Replies
Replies (0)