I am pretty new to Python, but I encountered this problem when someone tried recommending me to use packages. My directory (not actual names but just for example's sake) are as follows:
Main_Folder
- First_folder
__init__.py
first_file.py
- Second_folder
__init__.py
second_file.py
__init__.py
third_file.py
I want to use some functions I created on first_file inside second_file so I wrote both (on different times, not same):
from .first_folder import first_file
from Main_Folder.first_folder import first_file
And I get errors like:
<from first import>
ModuleNotFoundError: No module named '__main__.first_file'; '__main__' is not a package
<from second import>
ModuleNotFoundError: No module named 'Main_Folder'
However, when I do an import for third_file to any of the files inside using, it WORKS:
from First_folder.first_file import some_function
So I was just wondering if i was doing something wrong. I know there are lots of questions like this existing and I already looked but i cannot get anything to work.. And I am new to Python too...
Update: I ran both codes using their full absolute path