Refreshing imported modules in ArcGIS Python Toolbox?

I found this possibility, https://stackoverflow.com/questions/1517038/python-refresh-reload

The one caveat is that if you have any variables assigned to the module, they will need to be assigned again.

But as you have it written above, you could do this:

import supporting_module
def execute()
  reload(supporting_module)
  ...

This way every time you run the tool you'll be sure to have the updated module. Once development is done, this can be taken out.


Here is a different and more robust way than I suggested before.

I haven't used this module myself, but I think it would solve your problem:

Python Module Reloader

This library implements a dependency-based module reloader for Python. Unlike the builtin reload() function, this reloader will reload the requested module and all other modules that are dependent on that module.

Given the previous example, this should load all the dependancies with one call:

import reloader
reloader.enable()

import supporting_module

def execute()
  reloader.reload(supporting_module)
  ...

This is the first time I've noticed this module, so if you implement it in your tools, comment back on how well it works for you.