module reloading and unloading python provides no real support for reloading or unloading of previously imported modules although you can remove module from sys modulesthis does not generally unload module from memory this is because references to the module object may still exist in other program components that used import to load that module moreoverif there are instances of classes defined in the modulethose instances contain references back to their class objectwhich in turn holds references to the module in which it was defined the fact that module references exist in many places makes it generally impractical to reload module after making changes to its implementation for exampleif you remove module from sys modules and use import to reload itthis will not retroactively change all of the previous references to the module used in program insteadyou'll have one reference to the new module created by the most recent import statement and set of references to the old module created by imports in other parts of the code this is rarely what you want and never safe to use in any kind of sane production code unless you are able to carefully control the entire execution environment older versions of python provided reload(function for reloading module howeveruse of this function was never really safe (for all of the aforementioned reasons)and its use was actively discouraged except as possible debugging aid python removes this feature entirely soit' best not to rely upon it finallyit should be noted that / +extensions to python cannot be safely unloaded or reloaded in any way no support is provided for thisand the underlying operating system may prohibit it anyways thusyour only recourse is to restart the python interpreter process packages packages allow collection of modules to be grouped under common package name this technique helps resolve namespace conflicts between module names used in different applications package is defined by creating directory with the same name as the package and creating the file _init_ py in that directory you can then place additional source filescompiled extensionsand subpackages in this directoryas needed for examplea package might be organized as followsgraphics_ _init_ py primitive_ _init_ py lines py fill py text py graph d_ _init_ py plot py graph d_ _init_ py plot py formats_ _init_ py gif py lib fl ff