module has no attribute

The problem is submodules are not automatically imported. You have to explicitly import the api module: If you really insist on api being available when importing myproject.mymodule you can put this in myproject/mymodule/__init__.py: Then this will work as expected: