I am following this example on how to package a python module. But installing my built package with pip, when I tried to use it, while the following works.
from towel_stuff import towel_utils
x = towel_utils.has_towel()
print(x)
And this also works,
import towel_stuff.towel_utils
x = towel_stuff.towel_utils.has_towel()
print(x)
I don't understand, why the following doesn't work.
import towel_stuff
x = towel_stuff.towel_utils.has_towel()
print(x)
Normally, for example if we want to use os.path, we don't need to write import os.path, but just import os is enough. So, with my built package, why do I have to give the full package path?
Of course I can use from towel_stuff import * to import everything, but was just curious why we don't need to give the full path for standard packages.