How to import model from one app to another?

The issue I face:

 Error: ModuleNotFoundError: No module named 'CVBuilderApp.cvs'

What I did: In my main app views file i.e, in the CVBuilderApp.views file
views.py:
from CVBuilderApp.cvs.models import PersonalInfo

My project structure:

CVBuilderApp
- accounts
  - models, urls, views
- cvs
  - models, urls, views
- CVBuilderApp
  - settings.py
- manage.py

How do I import the model while the main application name and the project name are the same? Please help

you should not write project name in imports, so your imports must be something like this:

from cvs.models import PersonalInfo

from csv.models import PersonalInfo

Imports are relative. You can calling python manage.py runserver so everything is relative to manage.py


Example
CVBuilderApp (root)
- helpers (dir)
  - helperofhelper (dir)
      - doesthing.py    <- Import this

  - cvsHelper.py        <- from Here

- manage.py

if wanting to import doesthing inside of cvsHelper
you would not do from helperofhelper.doesthing import dothing
you would do from helpers.helperofhelper.doesthing import dothing

edit: missed the from

Model location is relative to the location of manage.py file. so you need to enter:

from cvs.models import PersonalInfo
Back to Top