I have several folders and .pyfiles in the following structure:
parent/
__init__.py
test.ipynb
code/
__init__.py
common.py
subcode/
__init__.py
get_data.py
In the file __init__in the folder parentI have import code, and in codeI have import subcode. But when I tried import code.subcode, I got this error:
ImportError: No module named 'code.subcode'; 'code' is not a package
But when I am simple import code, an error does not occur. However, when I call code.subcode, this error occurs:
AttributeError: module 'code' has no attribute 'subcode'
I will try all of the above in test.ipynb, which is in the root of the directory.
Do you know what the reason is and how I can fix it? Thank!
source
share