You have to import imp
before you can use it, just as with any other module:
>>> import bigmeesh
>>> import imp
>>> imp.reload(bigmeesh)
Note that the documentation clearly says:
Note: New programs should use importlib
rather than this module.
However, in 3.3, importlib
doesn't have a simple reload
function; you'd have to build it yourself out of importlib.machinery
. So, for 3.3, stick with imp
. But in 3.4 and later which do have importlib.reload
, use that instead.
It's also worth noting that reload
is often not what you want. For example, if you were expecting bob
to change into an instance of the new version of bigmeesh.testmod()
, it won't. But, on the other hand, if you were expecting it to not change at all, you might be surprised, because some of its behavior might depend on globals that were changed.