Related to project 10

The code:


The error:


The error is :
Attribute error: “Email” has no attribute 'analogRead(‘A0)’
How to resolve this error? I have installed pip, email and whatever I could get from other posts and my filename is also not email.py.

@Layeba_Faheem You have initialized the mybolt variable two times. Once with the Bolt() function and then just below the line, you have again assigned it to Email().

So, at the end of line mybolt = Bolt(), the mybolt variable has the Bolt class. At the end of the line, mybolt = Email() the same variable mybolt is assigned to Email class.

As the Email class does not have the function analogRead() it is throwing that error.
You will need to create a new variable like bolt_email = Email(...) and then use that variable to send the email.

1 Like

Oh! My bad, I haven’t seen that. Thanks for bringing that to notice. :slight_smile: