so this means the "import" does not know to find the appropriate packages recursively?
That's right. The docs for sys.path
don't mention recursion anywhere.
In fact, if module resolution were recursive, you'd get confusing behavior. Suppose /usr/lib/python2.7/site-packages/ham
were on the search path, and you'd have files
/usr/lib/python2.7/site-packages/ham
/usr/lib/python2.7/site-packages/ham/ham/util.py
and you'd do import util
. If no util.py
or util/__init__.py
were found on the search path directly, recursive processing would then cause ham.util
to be imported with the wrong name, defeating Python's package/module namespaces.