Form not found - import error

Hello and welcome,

Is this the exact code? I ask because you have .Form2 (notice the dot) and this would lead to a syntax error AFAIK.

There are a couple ways to open new forms depending on how you have things set up.

If you just want to open a new page and you don’t need the navigation side bar or any of the other Material design-specific details you can just use:

open_form('form_2') # the string is your form's name

If you are using the Material design and want to clear its main content panel and replace it with a new form, you can do this in general:

from ..Form2 import Form2 # this is likely what you were missing

.
.
.

form2=Form2()
self.content_panel.clear()
self.content_panel.add_component(form2)

Here is a clone that demonstrates this concept:
https://anvil.works/build#clone:S7VZI3LMALYDP7AT=K74MJOGULMXVPEMADCUDKJHZ


Other notes:

I’ve moved this to a its own topic. It is not useful to other users to reply on old and unrelated topics.

You do not need to ping Anvil staff with “@someone” as they monitor the forum very closely.

You can format your code nicely on the forum by wrapping your code in bacticks. Example,

```python

print('this will be nicely formatted and easy to read')

```
5 Likes