I am using streamlit-option-menu and there is an option for reload.
from streamlit_option_menu import option_menu
selected = option_menu(
menu_title=None,
options=["Home","Reload", "About & Disclaimer","Tutorial"],
icons=["house","repeat", "book",'play'],
menu_icon="Cast",
orientation="horizontal"
)
What I want to achieve is Reload the app when user clicks on it.
I have used streamlit.rerun()
but when I click on the option the apps keep on loading again and again until I stop it. I also read the documentation st.markdown() supports javascript where I can pass URL of my app but first user has to click the markdown which is something I also dont want.
url = "http://www.example.com"
js_code = f"""
<script>
window.location.href = '{url}';
</script>"""
st.markdown(js_code, unsafe_allow_html=True)