-2

I tried to import models from one app to another by using the following:

from ..appName.models import className also

from appName.models import className

but attempted relative import beyond top-level package error occured. My aim is to create a student management system. In one app i created the model and in another app i try to retrive data from that model but failed to do it..

├───Save_to_database
│   ├───HelpingClass
│   │   └───__pycache__
│   ├───migrations
│   │   └───__pycache__
│   └───__pycache__
├───Search
│   ├───migrations
│   │   └───__pycache__
│   └───__pycache__
├───StudentApp
│   └───__pycache__
└───templates

I want to import models from save_to_database into Search.

And yes i added the app in settings.py

Excuse my english

  • 1
    This answer could be helpful: [https://stackoverflow.com/questions/31406662/django-unable-to-import-model-from-another-app](https://stackoverflow.com/questions/31406662/django-unable-to-import-model-from-another-app) – analytical_prat Jul 16 '20 at 13:59
  • Does this answer your question? [Django : Unable to import model from another App](https://stackoverflow.com/questions/31406662/django-unable-to-import-model-from-another-app) – Daniel Morell Jul 16 '20 at 14:01

1 Answers1

0
├───Save_to_database
│   ├───HelpingClass
│   │   └───__pycache__
│   ├───migrations
│   │   └───__pycache__
│   └───__pycache__
├───Search
│   ├───migrations
│   │   └───__pycache__
│   └───__pycache__
├───StudentApp
│   └───__pycache__
└───templates

I want to import models from save_to_database into Search.

And yes i added the app in settings.py