How to pass parameters through url between multiple pages

How to pass parameters through url between multiple pages?

Hi!
I think you could use query params for that.
(This plus session_state to store the params if needed).
What is precisely what you want to do?

See the docs on query params:

In fact, I am a new streamlit. I have created two pages. I want to click the link in 1.py to jump to the 2.py page and bring a value on the 1.py page to 2.py. So now I want to transfer the value of a variable in 1.py to / pages / 2.py so that it can be used in 2.py. How can I do this? Thank you in advance!

There are different solutions, it all depends on what is simpler for your particular case. What you want can be done, but would require some coding and logics to handle the redirections.

Some easier solutions:

  • Put the widgets to get the value on the sidebar (st.sidebar).
  • Use a third page that conditionally renders the content on 1.py by default, and after selecting something, renders the page 2.py (having stored the variable value in session_state).

Does it help?

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