How do I navigate between forms in my Anvil app?

Peter writes: I have several forms in my app and I want to switch between them when the user clicks links in my navigation bar. How can I navigate from one form to another?

Hi Peter,

You’re looking for the open_form method. This will either navigate to an existing instance of a form:

f = Form1("First arg", "Second arg")
open_form(f)

or create a new instance of the named form and navigate to that:

open_form("Form1", "First arg", "Second arg")

The second version here can be particularly useful when trying to avoid circular imports.

Hope that helps!