You must import imp before you can use it, like any other module:
>>> import bigmeesh >>> import imp >>> imp.reload(bigmeesh)
Please note that the documentation clearly says:
Note. Newer programs should use importlib , not this module.
However, in 3.3, importlib does not have a simple reload function; You will have to build it yourself from importlib.machinery . So for 3.3, stick with imp . But in 3.4 and later versions that have importlib.reload , use this instead.
It's also worth noting that reload often not what you want. For example, if you expected bob change to an instance of the new version of bigmeesh.testmod() , this will not happen. But, on the other hand, if you expected that it will not change at all, you may be surprised, because some of its actions may depend on the changed global variables.
abarnert
source share