Skip to content Skip to sidebar Skip to footer

Python Flask Heroku Cannot Import Module

I am getting the following error 'ModuleNotFoundError: No module named 'class1'' Structure - hello-world - src - __init__ - main - class1 - Procfile The m

Solution 1:

You have to import the class using:

from .class1 import G

Do not forget the dot. When you build a package you have to tell where your class is written using this relative path. This is called intra-package references.

See the corresponding doc.


Solution 2:

should be like this

from hello-world.src.class1 import G

first rename your folder hello-world.. Python does not recognize operands to class name or folder name. it will return an error


Post a Comment for "Python Flask Heroku Cannot Import Module"