🐛 fix absolute import

This commit is contained in:
yanyongyu 2021-08-06 15:13:36 +08:00
parent 2fe01f33e0
commit ceebe0e95d

View File

@ -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