Suppose in the current directory there is a file named somecode.py
, and a directory named somecode
which contains an __init__.py
file. Now I run some other Python script from this directory which executes import somecode
. Which file will be imported - somecode.py
or somecode/__init__.py
?
Is there even a defined and reliable search order in which this is resolved?
Oh, and does anyone have a reference to official documentation for this behavior? :-)