diff --git a/jedi/imports.py b/jedi/imports.py index 81669ba1..3c08c9a3 100644 --- a/jedi/imports.py +++ b/jedi/imports.py @@ -91,6 +91,11 @@ class ImportPath(pr.Base): and len(self.import_stmt.namespace.names) > 1 \ and not self.direct_resolve + @property + def is_absolute(self): + module = self.import_stmt.get_parent_until(pr.IsScope) + return module.absolute_imports + def get_nested_import(self, parent): """ See documentation of `self.is_nested_import`. @@ -252,7 +257,7 @@ class ImportPath(pr.Base): return importing - if self.file_path: + if self.file_path and not self.is_absolute: sys_path_mod = list(self.sys_path_with_modifications()) sys_path_mod.insert(0, self.file_path) else: