code: def multipage_app(validation=False):
      app = Dash(
          __name__,
          suppress_callback_exceptions=(validation == "suppress"),
      )
  
      skeleton = html.Div(
          [
              dcc.Location(id="url", refresh=False),
              html.Div(id="page-content"),
          ]
      )
  
      layout_index = html.Div(
          [
              dcc.Link(
                  'Navigate to "/page-1"', id="index_p1", href="/page-1"
              ),
              dcc.Link(
                  'Navigate to "/page-2"', id="index_p2", href="/page-2"
              ),
          ]
      )
  
      layout_page_1 = html.Div(
          [
              html.H2("Page 1"),
              dcc.Input(
                  id="input-1-state", type="text", value="Montreal"
              ),
              dcc.Input(
                  id="input-2-state", type="text", value="Canada"
              ),
              html.Button(
                  id="submit-button", n_clicks=0, children="Submit"
              ),
              html.Div(id="output-state"),
              html.Br(),
              dcc.Link('Navigate to "/"', id="p1_index", href="/"),
              dcc.Link(
                  'Navigate to "/page-2"', id="p1_p2", href="/page-2"
              ),
          ]
      )
  
      layout_page_2 = html.Div(
          [
              html.H2("Page 2"),
              dcc.Input(id="page-2-input", value="LA"),
              html.Div(id="page-2-display-value"),
              html.Br(),
              dcc.Link('Navigate to "/"', id="p2_index", href="/"),
              dcc.Link(
                  'Navigate to "/page-1"', id="p2_p1", href="/page-1"
              ),
          ]
      )
  
      validation_layout = html.Div(
          [skeleton, layout_index, layout_page_1, layout_page_2]
      )
  
      def validation_function():
          return (
              skeleton
              if flask.has_request_context()
              else validation_layout
          )
  
      app.layout = (
          validation_function if validation == "function" else skeleton
      )
      if validation == "attribute":
          app.validation_layout = validation_layout
  
      # Index callbacks
      @app.callback(
          Output("page-content", "children"), [Input("url", "pathname")]
      )
      def display_page(pathname):
          if pathname == "/page-1":
              return layout_page_1
          elif pathname == "/page-2":
              return layout_page_2
          else:
              return layout_index
  
      # Page 1 callbacks
      @app.callback(
          Output("output-state", "children"),
          [Input("submit-button", "n_clicks")],
          [
              State("input-1-state", "value"),
              State("input-2-state", "value"),
          ],
      )
      def update_output(n_clicks, input1, input2):
          return (
              "The Button has been pressed {} times,"
              'Input 1 is "{}",'
              'and Input 2 is "{}"'
          ).format(n_clicks, input1, input2)
  
      # Page 2 callbacks
      @app.callback(
          Output("page-2-display-value", "children"),
          [Input("page-2-input", "value")],
      )
      def display_value(value):
          print("display_value")
          return 'You have selected "{}"'.format(value)
  
      return app
  
imports: import flask
  import pytest
  from dash import Dash, Input, Output, State, MATCH, ALL, ALLSMALLER, html, dcc
  from dash.testing import wait
label_desc: Use image node_id 16 for calling a global function with example usage: multipage_app(validation) and returns: app, unknown, str, str, layout_page_1, layout_page_2, layout_index