If you structure your project this way:
src\
__init__.py
main.py
dirFoo\
__init__.py
Foo.py
dirBar\
__init__.py
Bar.py
Then from Foo.py you should be able to do:
import dirFoo.Foo
Or:
from dirFoo.Foo import FooObject
Per Tom's comment, this does require that the src
folder is accessible either via site_packages
or your search path. Also, as he mentions, __init__.py
is implicitly imported when you first import a module in that package/directory. Typically __init__.py
is simply an empty file.