Replies: 1 comment 1 reply
-
The way Python imports work is that they're executed once and then cached so subsequent imports are cheap. The library maintains ownership of the imports for the extensions (in this case, Working with these types of dependencies tends to be complicated in the general case. In Python you can use import sys, importlib
sys.modules['foo.bar'] = importlib.reload(sys.modules['foo.bar']) Note that you need to do this before reloading the extension for your changes to take effect. Getting the modules that you need to reload is a bit complicated, and that depends entirely on how your program is structured. I'll leave that bit up to you. Hopefully these crumbs are enough to let you put together the entire piece. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am currently working on rewriting my bot, while trying to make the extensions "cleaner" in my opinion I came across a behavior that I do not really understand.
With the view and modal, I wanted to be able to separate them in separate files and so I imported them into my Cog.
But the problem is that when I try to reload one of these extensions it seems that the imported files are not reloaded.
How can I do to force the re-import of these files?
my cogs folder looks like this :
├── backend
├── cogs
│ ├── plugin_name
│ │ ├── plugin.py
│ │ ├── view.py
│ │ ├── other_view.py
here the changes of plugin.py are loaded but not those of view.py and other_view.py
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions