[Answered ]-ModuleNotFoundError: No module named 'PyDemo.accounts'

2👍

It seems like your project name is PyDemo and the name of the module is accounts. So try using

from accounts.views import my_view

You may find an error (underlined by red mark) that is because of your IDE so ignore it and migrate it. It will work

0👍

For anyone else with this issue who is migrating from Python 2 to 3 it seems to be because Python 3 is more discerning about where to find modules. @Ranjith Singhu’s comment sent me in the right direction. In my case I had to change:

Python 2:

from views import MyView

Python 3 (also fine in 2):

from project_name.views import MyView

Leave a comment