NameError: name 'blog' is not defined at Main, line 58

I am trying to add a Form named bolg to the sample website. and link the added Form to the main. At this time, I was told “NameError: name ‘blog’ is not defined at Main, line 58”

I am a newbie and I would be happy if you could tell me what the problem is.

What I’ve tried and what’s not working:
I compared the newly added Form with the original Form settings and didn’t find any difference.

Code Sample:

# this is a formatted code snippet.
# paste your code between ``` 

def faq_link_click(self, **event_args):
“”“This method is called when the link is clicked”""
self.content_panel.clear()
self.content_panel.add_component(FAQ(), full_width_row=True)

def blog_link_click(self, **event_args):
“”“This method is called when the link is clicked”""
self.content_panel.clear()
self.content_panel.add_component(blog(), full_width_row=True)

Clone link:
share a copy of your app
https://anvil.works/build#clone:5RHYOOZM6RQ64JXA=VKGKR5LZBVCF3MCHWBMCIH44

The error pretty much says what is wrong. Nothing like a blog exists. Please refer to the docs for more information about opening forms Anvil Docs | Navigation

Thank you for your reply. I guess I wasn’t clear enough in my instructions, bolg can be found in the clone link. Also, I will refer to Anvil Docs | Navigation, thanks a lot!

As @divyeshlakhotia says, there is no blog() in that form. That’s what the error message means, and generally speaking Python doesn’t lie. You should always assume that the error message is telling you the truth, and try to work out why.

  1. Did you import the right form?

  2. Did you spell it right?

  3. Did you capitalize it right?

Any of those can cause the issue you’re seeing.

1 Like

Thank you for your patience and clarification, I know the cause of the problem. Let me try to modify it. Thanks!

1 Like