Imagine this directory structure:
app/ __init__.py sub1/ __init__.py mod1.py sub2/ __init__.py mod2.py
I\'
As @EvgeniSergeev says in the comments to the OP, you can import code from a .py file at an arbitrary location with:
.py
import imp foo = imp.load_source('module.name', '/path/to/file.py') foo.MyClass()
This is taken from this SO answer.