Changes to imported module ignored

I’m running Mac OS. If I change and save the contents of a file that is being imported as a module, the importing file ignores the changes unless I restart Rhino. This is true even if I also change and save the importing file before running it. What am I doing wrong?

Here’s an example:

imported Module (

astring = "hello world"

Importing file (

import mod_a as m 

if __name__ == '__main__':    
   print m.astring

I can change the contents of and it has no impact on unless i restart Rhino and rerun the script

I think that the modules are only loaded once at startup… It’s that way in Windows as well.


RhinoScript can be reset from Rhino and Python can from the script editor in Windows- I wonder, @stevebaer, if we need a command in Rhino as well for resetting Iron Python ?


This is how python works and is what the reload function is for

Ah, OK, that should work, I was thinking of a command corresponding to Rhiino’s ResetRhinoScript.