NameError: name 'reload' is not defined

You probably wanted importlib.reload().

from importlib import reload

In Python 2.x, this was a builtin, but in 3.x, it's in the importlib module.

Note that using reload() outside of the interpreter is generally unnecessary, what were you trying to do here?


An update to @Gareth Latty's answer. imp was depreciated in Python 3.4. Now you want importlib.reload().

from importlib import reload

Try importlib.reload.

Reload a previously imported module. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module source file using an external editor and want to try out the new version without leaving the Python interpreter.

from importlib import reload

reload(module_name)