I am using Python 3.10.
- I created a module
os.py
in a directory,my_dir
. - I am trying to access my
os.py
usingimport os
, frommy_dir
directory. - But it is loading Python's
os
module, not mine. - I inserted
my_dir
insys.path
as a first element, but still it's loading Python'sos
module. - I repeated the same with another standard library of Python 3,
datetime
. But it's working as expected. i.e., it's loading mydatetime.py
, not Python's.
Why does only the os
module have this problem? Is it a bug in Python 3?