Why can't I make a short cut name for a module and use that module to import things?
For example:
import utils.utils as utils
print(utils)
print(utils.make_and_check_dir)
From the print statement we can see that the utils
package does indeed have my function but then the following import fails (confusingly to me):
from utils import make_and_check_dir
Why? Is there no way to make a short hand for:
pkg.module
?
Error msg:
<module 'utils.utils' from '/Users/pinocchio/git_project/project/utils/utils.py'>
<function make_and_check_dir at 0x11a428ea0>
Traceback (most recent call last):
File "code.py", line 10, in <module>
from utils import make_and_check_dir
ImportError: cannot import name 'make_and_check_dir' from 'utils' (/Users/pinocchio/git_project/project/utils/__init__.py)