I have a Python package called mylib
that has a module inside named os
:
mylib
|- __init__.py
|- os
|- __init__.py
|- makedirs.py
Now when I import mylib
, its __init__.py
gets called:
from os import environ
from os.path import dirname, join, abspath
# then do something with the paths
Here I'm trying to use the builtin os
, but my Python seems to think I want to use mylib
's module os
, hence throwing:
ImportError: No module named path
I know some people are against using the same names for custom names as standard built-in names, but I really think I should keep the name os
, as it's the most intuitive and easy-to-remember name.
In this case, how do I let my Python know it should import the builtin os
?