No module name A error even after adding the path to sys.path

Viewed 29

I have the following package structure:

A/
  a1.py
  __init__.py
   B/
    __init__.py
    a2.py
   C/
    a3.py
    __init__.py

Now I would like to import a from from a2.py into a3.py. Assume my function name is func_a2. so I go to module a3.py and I write

from A.a2 import func_a2

I get the error: no module name A I try to add the A to the sys.path using sys.path.append('..') But again I receive the same error. I am running it from terminal by going C folder and type

python a3.py

so it is not running from jupyter notebook or anything. I have read articles in the internet and browse through questions here but still do not know how to make this work. Can someone first explain what is the problem and how I can solve this error?

0 Answers
Related