ModuleNotFoundError: No module named 'apidjangowithjwt.emailservice'

https://stackoverflow.com/questions/60870963/modulenotfounderror-no-module-named-apidjangowithjwt-emailservice

Attached is the folder structure of project

The top level folder is not a Python module, it’s the one that contains the __init__.py that is. Therefore you want to import emailservice, without the prefix.

@adamchainz I didn’t get you. Could you please go through the stackoverflow link and see the comments. I tried following:-

  1. from emailservice.views import send_email
  2. from …emailservice.views import send_email
  3. from apidjangowithjwt.emailservice.views import send_email

and for each one of these I am getting different error

The error:

ImportError: cannot import name ‘send_email’ from ‘emailservice.views’

Implies the import worked, but you don’t have an object with the name send_email in that module.

UnresolvedReference

Thanks @adamchainz .Even I am surprised but I don’t know where was my fault.
Could you please do one favour…
This import is working but its showing underlined with red font.
And when I am mouse hovering over it, it’s showing unresolved reference “send_email”

That’s something to do with your editor, rather than Python itself. You should check your editor’s Python configuration.