0

i want import a python file in to another directory, such as below:

a/
  __init__.py
  file1.py
  file2.py
b/
  __init__.py
  file3.py
  file4.py

I use from this code form ..a.file1 import * in file3.py. i get this error:

ImportError: attempted relative import with no known parent package

I'm using VSCode, and debian linux. I read another posts in stachoverflow and use

SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))

sys.path.append(os.path.dirname(SCRIPT_DIR))

but my problem is not solved. help me pleas.

Yevhen Kuzmovych
  • 10,940
  • 7
  • 28
  • 48

0 Answers0