ModuleNotFoundError: No module named '_anvil_designer' at Homepage, line 1

Hi!

I converted an existing app to use Layouts. I cannot use the layout yet because I get the following error:

ModuleNotFoundError: No module named '_anvil_designer'

  • at Homepage, line 1

If I create a new app everything works as expected. I only have Forms in this existing app.

Can you paste a code snippet of the offending code?

I get this message regularly, at Design time (i.e., in the IDE). In my case, I have a mixture of old (pre-package, module-based) and new (package-based) forms, many of them being components. When a new-style form (component) is used on an on-screen form, and the new-style form incorporates an old-style form, the Designer produces this message, when trying to render the old-style form.

When I convert the (used) old-style (module-based) form into a new-style (package-based) form, this message goes away.

Looks to me like any rendered component has to be new-style (package-based) all the way down, to avoid this message.

The problem for me is that this message appears on a completely new package based form. I cannot add any components (TextBoxes etc) to the new forms that are using the Layout, since they only show the error message.

I have the “Vanilla” form code and this is a completely new form that uses the Homepage layout.

from ._anvil_designer import Form1Template
from anvil import *
import anvil.server
import anvil.tables as tables
import anvil.tables.query as q
from anvil.tables import app_tables
import anvil.users

class Form1(Form1Template):
    def __init__(self, **properties):
        # Set Form properties and Data Bindings.
        self.init_components(**properties)

        # Any code you write here will run before the form opens.

I’m not seeming to have any problems, but maybe you are doing something different.