For example I have this package:
└── package
│ __init__.py
│ first.py
│ second.py
and in my first.py
#first.py
def foo(): pass
in second.py
#second.py
from .first import foo
if __name__=='__main__':
foo()
Now if i try to execute the second.py as:
$ cd package
$ python3 second.py
I got this error:
ModuleNotFoundError: No module named '__main__.first'; '__main__' is not a package
why does this happen?