Make sure import path is calculated relative from the importing file.
@@ -1122,6 +1122,8 @@ def act_import(context, nodes):
module_name = nodes[3] if len(nodes) > 3 else None
if module_name is None:
module_name = path.splitext(path.basename(import_path))[0]
+ if not path.isabs(import_path):
+ import_path = path.realpath(path.join(context.file_name, import_path))
return PGFileImport(module_name, import_path)
