Persistent NameError: ...Template is not defined

Hello,

I am consistently getting the error NameError: name 'FormNameTemplate' is not defined on my apps.

The strange part is that this now happens even on a brand new, completely blank app with a single default form.

I have already tried extensive debugging, including:

  • Ensuring all form imports are local to functions (no circular dependencies).
  • Checking for and removing a rogue __init__.py file via a local Git clone.
  • Cloning the entire app on the Anvil platform.
  • Manually rebuilding the app from scratch in a new project.

Even after creating a new blank app with a single Form1 and no code, it still fails with this error. This suggests the issue might be with my account’s environment. Could you please investigate?

Here is the clone link for one of the failing apps:

it looks like you’re deleting the auto generated import

from ._anvil_designer import Form1Template

later you use this class as the base class for Form1

class Form1(Form1Template):

I tried adding new forms to the cloned app, and the auto imported template was always there for me.
If it’s not showing up for you, could you provide some steps to reproduce the issue?

2 Likes

Thankyou Stu, I think I got a bit code blind!

2 Likes