Patterson
Patterson

Reputation: 336

I cannot import a module and I don't know why Python: ImportError: Cannot import name X

I'm having the following error when I try to run a Flask app:

 File "/home/patterson/Documentos/CPFL/cpfl/computer.py", line 12, in <module>
        from cpfl.cpfl import sendmail
    ImportError: cannot import name 'sendmail'

sendmail is a function I'm trying to import from the cpfl.py module which is a flask app. cpfl.py:

...
app = Flask(__name__)
...

The structure of my project is as follows:

enter image description here

I have no idea why import does not work. Could someone help-me?

Upvotes: 1

Views: 454

Answers (1)

Marcus Beckenkamp
Marcus Beckenkamp

Reputation: 71

Have you tried import cpfl and then when you call the method you use cpfl.sendmail?

Upvotes: 1

Related Questions