Streamlit rerun

Hi, I would like to rerun my app from a python script, I tried some thing like:
from streamlit.ScriptRunner import RerunException
raise RerunException
I got the following error ModuleNotFoundError: No module named ‘streamlit.ScriptRunner’,
I guess that this module was depreciated. is there any alternative to rerun my app from my script.

Hey @khalidbouziane,

There is actually, but it is in our experimental area (see the docs on caveats to using experimental commands).

You can use st.experimental_rerun() at the point where you would like your code to rerun from the top!

Happy Streamlit-ing!

thank you for your fast reply, do I need to import a specific model before using st.experimental_rerun(), and which version of streamlit do I need to have

Hey @khalidbouziane,

I’m not sure what you mean by this?

The experimental rerun works with the current version of Streamlit!

I want to say module.

1 Like


No, you can use it in any Streamlit script, no additional module imports are needed! :smile_cat:

Happy Streamlit-ing!

Hey Hi ! So when I do st.experimental_rerun() , the st.experimental_getqueryparams() are becoming empty meaning the URL is becoming empty is there any way where URL is saved when script is rerun? I need this help because I want to navigate accross pages using URL query params.