Navigation in multipage app

Hello all,

Is possible in a multipage app to navigate from a page to another (so no refreshing of the url), with the buttons and not with the navigation bar? I find it very annoying and not user friendly at all.

Thank you,
Lorenzo

1 Like

Yes, see for example:

https://extras.streamlitapp.com/Switch%20page%20function

1 Like

I’m sorry, but this does exatly what I wanted to avoid. I have a multipage app that is run only once from app.py and the only way to navigate in the different pages is to go in the app navigation and select the one I want to visit
image

If I’m in a page and i select the other one the url is always the same (in my example is localhost:xxxx). With this method the url is setted to localhost:xxxx/page2, but this doesn’t show up anything because it’s not the correct url of my app.

The thing that I would like is to have a button that having the same url for all the pages (localhost:xxxx as it’s a multipage application) allows me to navigate threw the pages exactly like the App Navigation markdown allows me to do

Edit: maybe am I missing something? Because in the documentation of the multipage apps it’s visible that the url is different from page to page, so at this point my question is… why mine it’s not refreshing?

Hi,
Do you have a simple example code of the issue you are facing?
Also, what version of streamlit are you using and what is your folder structure?

Streamlit 1.13.0

This is the app.py file (outside the pages folder) [please ignore totally line 26]

And this is the code of prova.py that is inside the pages folder

Thank You :slight_smile:

With the new streamlit built-in pages I don’t think you need these two imports:

image

You also don’t need to import the pages:

image

or this
image

Perhaps this example is helpful?

or this video?

Hi Luke, yes now everything is working. I don’t know why there still were those app item and calls (source code was not mine). Anyway now I’m able to peform the action I wanted even if the url is changing it doesn’t mind :joy:.
Thank you very very much!

Lorenzo

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.