I want to try really simple example of Python package. It seems to be okay on IDE as it does not show any error or warnings, but when i execute the files, i get error which is really weird.
$ tree
.
├── ReadMe.md
├── __init__.py
├── a.py
└── b.py
$ pwd
$HOME/workspace/devops-essentials/languages/python/simple_package
a.py
def bar():
print("Hello, function 'bar' from module 'a' calling")
b.py
from simple_package import a
def foo():
print("Hello, function 'foo' from module 'b' calling")
a.bar()
$ python3 b.py
Traceback (most recent call last):
File "/Users/ankitsinghrathi/Ankit/workspace/devops-essentials/languages/python/simple_package/b.py", line 1, in <module>
from simple_package import a
ModuleNotFoundError: No module named 'simple_package'
$ python3 simple_package/b.py
Traceback (most recent call last):
File "/Users/ankitsinghrathi/Ankit/workspace/devops-essentials/languages/python/simple_package/b.py", line 1, in <module>
from simple_package import a
ModuleNotFoundError: No module named 'simple_package'