Skip to content

Commit 3f6c35d

Browse files
authored
Merge pull request jxxghp#4986 from Aqr-K/fix-plugin-reload
2 parents 9f73b47 + 0b20956 commit 3f6c35d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

app/core/plugin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ def _load_selective_plugins(pid: Optional[str], installed_plugins: List[str],
265265

266266
# 导入模块
267267
module = importlib.import_module(module_name)
268-
importlib.reload(module)
269268

270269
# 检查模块中的类
271270
for name, obj in module.__dict__.items():
@@ -411,6 +410,10 @@ def _clear_plugin_modules(plugin_id: Optional[str] = None):
411410
except KeyError:
412411
# 模块可能已经被删除
413412
pass
413+
414+
importlib.invalidate_caches()
415+
logger.debug("已清除查找器的缓存")
416+
414417
if plugin_id:
415418
if modules_to_remove:
416419
logger.info(f"插件 {plugin_id} 共清除 {len(modules_to_remove)} 个模块缓存:{modules_to_remove}")

0 commit comments

Comments
 (0)