import or from statement is required to load this tool in only readers using can ignore these imports in this book' examplesor use them anyhow-- also has reload in its imp module to ease migration to reloading works the same regardless of its packaging reload basics unlike import and fromreload is function in pythonnot statement reload is passed an existing module objectnot new name reload lives in module in python and must be imported itself because reload expects an objecta module must have been previously imported successfully before you can reload it (if the import was unsuccessful due to syntax or other erroryou may need to repeat it before you can reload the modulefurthermorethe syntax of import statements and reload calls differsas function reloads require parenthesesbut import statements do not abstractlyreloading looks like thisimport module use module attributes from imp import reload reload(moduleuse module attributes initial import nowgo change the module file get reload itself (in xget updated exports the typical usage pattern is that you import modulethen change its source code in text editorand then reload it this can occur when working interactivelybut also in larger programs that reload periodically when you call reloadpython rereads the module file' source code and reruns its toplevel statements perhaps the most important thing to know about reload is that it changes module object in placeit does not delete and re-create the module object because of thatevery reference to an entire module object anywhere in your program is automatically affected by reload here are the detailsreload runs module file' new code in the module' current namespace rerunning module file' code overwrites its existing namespacerather than deleting and re-creating it top-level assignments in the file replace names with new values for instancererunning def statement replaces the prior version of the function in the module' namespace by reassigning the function name reloading modules