Unloading a module in Python 3.x
Question: It's clear to me that there was no clean solution in Python 2 to unload a
module, and this was a known bug, that was set to be corrected.

The posts:

[How do I unload (reload) a Python
module?](http://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-
python-module/487718) [Remove an imported python
module](http://stackoverflow.com/questions/8781257/remove-an-imported-python-
module)

of the year 2009 and 2010 confirm this lack of support for unloading a module.

I wonder if this was solved in Python 3.x. When I do, `import os`, `del os`,
`dir()`, the `os` module is not there (at least not visible, usable). Is it
gone?


Answer: The `sys.modules` does still hold a reference to the module.

    
    
    >>> import six
    >>> del six
    >>> sys.modules["six"]
    <module 'six' from '/usr/lib64/python3.3/site-packages/six.py'>
    

sys.modules still holds a reference. So I don't think you can unload a module
in Python 3.3 either.

