From ceebe0e95df49c1fa04880217da6e34df3d53d83 Mon Sep 17 00:00:00 2001 From: yanyongyu Date: Fri, 6 Aug 2021 15:13:36 +0800 Subject: [PATCH] :bug: fix absolute import --- nonebot/plugin/manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nonebot/plugin/manager.py b/nonebot/plugin/manager.py index b317da97..77189370 100644 --- a/nonebot/plugin/manager.py +++ b/nonebot/plugin/manager.py @@ -189,7 +189,11 @@ class PluginManager: for path in paths: try: rel_path = Path(origin_path).relative_to(path) - return ".".join(rel_path.parts[:-1] + (rel_path.stem,)) + if rel_path.stem == "__init__": + return f"{self.internal_module.__name__}." + ".".join( + rel_path.parts[:-1]) + return f"{self.internal_module.__name__}." + ".".join( + rel_path.parts[:-1] + (rel_path.stem,)) except ValueError: continue