0

My directory structure is like the following:

toplevel/
    subdir/
        __init__.py
        foo/
          __init__.py
          foo.py
        bar/
          __init__.pt
          bar.py

if i try to from foo import foo in bar.py, and execute bar.py from subdir with python3 bar/bar.py it says foo was not found. I used os.getcwd() and it is toplevel/subdir, so it should work. I've tried relative imports, but none work.

shamilpython
  • 479
  • 1
  • 5
  • 18

1 Answers1

0

If you must do this, you can use sys.path to see what paths interpreter can load module from.

and then via sys.append('path you want add') to add path

zhuofanxu
  • 1
  • 1