[commands] unload cog submodules

When unloading cogs, currently we do not remove submodules from
sys.modules, meaning they will not be reloaded. Removing here
makes new imports reload from file. Of course, any already imported
modules will still hold a reference to the old module, since they
will not re-import it, and will not be forcably unloaded.
This commit is contained in:
khazhyk 2017-07-04 19:13:27 -07:00 committed by Rapptz
parent a037d469d7
commit fc22d288be

View File

@ -768,6 +768,9 @@ class BotBase(GroupMixin):
del lib
del self.extensions[name]
del sys.modules[name]
for module in list(sys.modules.keys()):
if _is_submodule(lib_name, module):
del sys.modules[module]
# command processing