How to reload imported modules after editing Win 6 SR21

I have python scripts that import a library script in the same directory that are working as expected. However, when I move a function from a script to the library (so I can use it in the other scripts) Rhino 6 bonks with an error message:

Message: ‘module’ object has no attribute ‘function_name_I_just_moved’

I’m guessing that the library I’ve imported is not getting reloaded after the edit. I’m a *nix Python person, not IronPython, so I’m wondering if I have to force a reload in Rhino.

Yes it may be worth trying to reload(module) and watch out for imports of type from x import y, which may not reload as expected.

Otherwise you may need to restart Rhino.

You could also try from __future__ import absolute_import to get modern behaviour on relative paths.

Reload fixed it:

import imp
import module
imp.reload(module)

Great!
No need for imp. reload was a builtin in python 2 so it works without import