From d712763147ebc937a3a6ed12b68d95c1a7e7d8ca Mon Sep 17 00:00:00 2001 From: James Lu Date: Fri, 12 Sep 2025 18:02:20 +0800 Subject: [PATCH] Invalidate importlib caches before attempting to load plugins This allows newly installed 3rd party dependencies and pip-installed plugins to become visible without restarting the bot. --- src/plugin.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugin.py b/src/plugin.py index a983f241a..3a65f20e0 100644 --- a/src/plugin.py +++ b/src/plugin.py @@ -71,6 +71,11 @@ def loadPluginModule(name, ignoreDeprecation=False): pluginDirs = conf.supybot.directories.plugins()[:] pluginDirs.append(_pluginsDir) module = None + + # Invalidate caches to allow new third party dependencies and plugins to be + # located without restarting the bot. + importlib.invalidate_caches() + for dir in pluginDirs: try: files.extend(os.listdir(dir))