I was studying python import machinery with the official document. I wanted to test what I learned. So I built a basic package and a module which look like as below
pkg
├─── __init__.py # (empty file)
└─── md.py
I instantiated an interactive python shell at the directory where pkg
is located. I could import pkg with no error(import pkg
). But when I tried to access md module which I thought included in pkg, It gave me an error.
>>> pkg.md
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'pkg' has no attribute 'md'
I think I was somehow wrong in understanding how import works in python, but I have no clue.