diff options
| author | khazhyk <[email protected]> | 2017-07-04 19:13:27 -0700 |
|---|---|---|
| committer | Rapptz <[email protected]> | 2017-07-07 18:02:29 -0400 |
| commit | fc22d288be30d8cfab7b03c2fdf23f3e03d3dffc (patch) | |
| tree | 1b8cd9828c695e108464e5547ed3b2f682538c8f | |
| parent | Add basic rewrite voice example (diff) | |
| download | discord.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.py | 3 |
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 |