Variable not defined erros in tutorial app

What I’m trying to do:
Ive gone through the basic form tutorial app verbatim. I have double checked the code 5x. The variables are clearly defined, as the tutorial specifically walks you through this.

What I’ve tried and what’s not working:
I keep receving this error:
NameError: name ‘name’ is not defined at [ServerModule1, line 32](javascript:void(0)) called from /libanvil/anvil_downlink_worker/init.py, line 70 called from /libanvil/anvil_downlink_worker/init.py, line 176 called from [Form1, line 25](javascript:void(0))

Code Sample:

import anvil.email
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
import anvil.server
from datetime import datetime

@anvil.server.callable
def add_feedback(name, email, feedback):
  app_tables.feedback.add_row(
    name = name,
    email = email,
    feedback = feedback,
    created = datetime.now()
)
  
  
anvil.email.send(to="jonathan.chatfield@outlook.com", 
                 subject=f"Feedback from",
                 text=f"""A new person has filled out the feedback form. Name: {name}  Email Address: {email} Feedback: {feedback}""")

Clone link:
share a copy of your app

Your ‘anvil.email.send’ line needs to be indented to the same level as the ‘app_tables.feedback.add_row’ line. (the closing bracket for that first call should really be indented too).

1 Like

Ahh, bonehead error. Thanks.