I am trying to import common/util module in my mains under feature1 and feature2 directory. I have used from ..common import util but getting ImportError: attempted relative import with no know parent package. Is there a way to import common/util inside main.
Directory Stucture
common
__init__.py
util.py
feature1
main.py
feature2
main.py
Yes there is - run your main from the parent directory of common, feature, etc - so:
$ ls
common feature1 feature2
$ python -m feature1.main
Note there is no .py
at the end