Patterson Patterson - 1 year ago 72
Python Question

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/", 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 module which is a flask app.

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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download