Yes, there are similar questions, but they do not answer my issue. My directory structure is as follows, all __init__.py files are blank.
Package/
__init__.py
sub_package1/
__init__.py
file1.py
sub_package2/
__init__.py
file2.py
In file2.py
I have the following code:
from ..sub_package1 import file1
I get the error mentioned above,
ValueError: attempted relative import beyond top-level package
There are a number of scikit-learn packages which do similar imports and it works for them.
Command that raised the error:
- working directory:
Package/
- Command:
python /path/to/Package/sub_package2/file2.py