Skip to content

Instantly share code, notes, and snippets.

@demmerichs
demmerichs / st_rerun.py
Last active April 9, 2020 20:24 — forked from tvst/st_rerun.py
Rerun a Streamlit app from the top! See https://discuss.streamlit.io/t/update-sidebar/531
import streamlit.ReportThread as ReportThread
from streamlit.ScriptRequestQueue import RerunData
from streamlit.ScriptRunner import RerunException
from streamlit.server.Server import Server
def rerun():
"""Rerun a Streamlit app from the top!"""
widget_states = _get_widget_states()
raise RerunException(RerunData(widget_states))