Chris
Chris

Reputation: 459

"No module named" error when importing models from other apps

I'm trying to import a model from another app.

I have a folder named "apps" where all my applications live.

so in the models.py of app2, i have the line:

from apps.app1.models import Book

but for some reason, i get the "No module named app1.models" error.

I'm using django1.9 if that matters.

Any advice?

Thanks.

Upvotes: 1

Views: 741

Answers (1)

Oleksiy
Oleksiy

Reputation: 816

I think from ..app1.models import Book will help you. It's a var of relative path to import.

Upvotes: 2

Related Questions