Hi,
There are some options to do this programatically (see these two issues clear cache and rerun):
To clear cache:
from streamlit import caching
caching.clear_cache()
To rerun script
from streamlit.ScriptRunner import RerunException
raise RerunException
Hope it helps!