-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG]: Updating or reloading plugins does not reload imported files. #3223
Comments
Side note: Since the file structure for modmail plugins is quite different, and the entry point is not in Luckily, unloading the modules or files in plugin's directory can be done manually, whether in the core of the bot ( # plugin here is the Plugin object
ext_parent = ".".join(plugin.ext_string.split(".")[:-1])
for module in list(sys.modules.keys()):
if module == ext_parent or module.startswith(ext_parent + "."):
del sys.modules[module] |
* Cleanup after unloading extension, resolve modmail-dev#3223. * Remove leftover modules loaded from `plugins` path when purging. --------- Co-authored-by: Taku <[email protected]>
* Cleanup after unloading extension, resolve modmail-dev#3223. * Remove leftover modules loaded from `plugins` path when purging. --------- Co-authored-by: Taku <[email protected]> (cherry picked from commit a784f82) Signed-off-by: Khakers <[email protected]>
* Cleanup after unloading extension, resolve modmail-dev#3223. * Remove leftover modules loaded from `plugins` path when purging. --------- Co-authored-by: Taku <[email protected]> (cherry picked from commit a784f82) Signed-off-by: Khakers <[email protected]>
Bot Version
v4.0.1
How are you hosting Modmail?
Other
Error Logs
None
Screenshots
No response
Additional Information
This only occurs on plugins that use multiple files.
More in-depth explanations can be found on discord.py discussions, here.
This happened to me quite a few times now since most of my plugins use multiple files. Updating the plugins does not re-import other files in same directory or sub-directories.
Steps to produce:
├── plugin_folder
│ ├── plugin.py
│ ├── views.py
views.py
.?plugin update ...
command. The changes inviews.py
do not take affect (at least until bot restart). If new attributes were added in a class inviews.py
, accessing it fromplugin.py
would raiseAttributeError
.The text was updated successfully, but these errors were encountered: