For example there is some folder:
.
├── file_a.py
├── file_b
│ └── __init__.py
└── file_b.py
where file_a.py
has something like:
from file_b import some_function
I know this is definitely not good practice, but what is the order of resolution behind?
i.e. How python decides which module to be imported for an "absolute import"?
Best Answer
I'm not sure where (or whether) this information is in the documentation - a quick check in the import system docs didn't turn it up - but PEP 420 says the following:
So according to PEP 420, if a package and a non-package module are found in the same directory with the same name, the package wins.