Button to clear cache and rerun

Is there a way to create a button on my page that does the following (a) clear cache and (b) rerun?

1 Like

Well the options of a) Clear Cache & b) Rerun are by default available on the right side menu of the Streamlit app.

Thanks! That is what I looking to automate in my script based on certain conditions. Are there commands for this in the API?


There are some options to do this programatically (see these two issues clear cache and rerun):

To clear cache:

from streamlit import caching

To rerun script

from streamlit.ScriptRunner import RerunException
raise RerunException

Hope it helps!

1 Like