In [4]:
import sys
sp =sys.path[0]
print "'%s' (type: %s)" % (sp, type(sp))
sys.path
contains the empty string as first element, which resolves to the folder where the script is executed. This is why we can import the modules lying next to this and below here.
In [2]:
import innerpackage
import mod1
import mod2
print mod1
print mod2.some_function
print mod2.someName
In [3]:
# the module inside the package is not imported automatically
print innerpackage.innermod
In [ ]:
import innerpackage.innermod
# now it is imported
print innerpackage.innermod