aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkhazhyk <[email protected]>2017-07-04 19:13:27 -0700
committerRapptz <[email protected]>2017-07-07 18:02:29 -0400
commitfc22d288be30d8cfab7b03c2fdf23f3e03d3dffc (patch)
tree1b8cd9828c695e108464e5547ed3b2f682538c8f
parentAdd basic rewrite voice example (diff)
downloaddiscord.py-fc22d288be30d8cfab7b03c2fdf23f3e03d3dffc.tar.xz
discord.py-fc22d288be30d8cfab7b03c2fdf23f3e03d3dffc.zip
[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.
-rw-r--r--discord/ext/commands/bot.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/discord/ext/commands/bot.py b/discord/ext/commands/bot.py
index 85b8d134..34ab30e2 100644
--- a/discord/ext/commands/bot.py
+++ b/discord/ext/commands/bot.py
@@ -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