[Answer]-Python package seems to be incorrectly imported as a module

1👍

The problem is that import shared doesn’t import child modules, but from shared.models import FOO does import all of the parent modules. You can import models in your __init__.py so that it comes in with import shared or you can specifically import shared.models after import shared.

shared/__init__.py:
    import models

import shared
print shared.models.FOO

or

import shared
import shared.models
print shared.models.FOO

Leave a comment