Page scoping and variables in Taipy

I have a structure of three separate pages called from main. Does each page have its own state variable or does the architecture create a single state variable that I can call from any of the pages? If they are separated, how do I call the states between pages?

Code organisation

I expect to use other variables from other pages, but I get an error message saying that other variables from other pages are not accessible.


  • Did you use the Markdown object of Taipy? If you don't use it, you should put all your variables in your main script to access it.

    from ... import xxx, yyy

    The variables and callbacks are scoped to your page if you use the Markdown object. It means you cannot access variables scoped on one page on another page. If they are common variables, you should have them in your main script. However, you can always access them with:


    Here is some documentation on variable binding.

    For example, you can look at this code from the Covid Dashboard demo. I am importing only the Markdown objects and the other necessary variables present on multiple pages.

    from taipy.gui import Gui
    import taipy as tp
    from import country_md
    from import world_md
    from import map_md
    from pages.predictions.predictions import predictions_md, selected_scenario
    from pages.root import root, selected_country, selector_country
    from config.config import Config
    pages = {
    gui_multi_pages = Gui(pages=pages)
    if __name__ == '__main__':
       "Covid Dashboard")

    And here (last row of on_change_params) I am using a callback function to update another page (Country page).

    def on_change_params(state):
        if state.selected_date.year < 2020 or state.selected_date.year > 2021:
            notify(state, "error", "Invalid date! Must be between 2020 and 2021")
            state.selected_date = dt.datetime(2020,10,1)
        notify(state, "success", "Scenario parameters changed!")