You haven't provided info about:
What Streamlit version you're using
What python you're using
Other info about your OS that could be relevant
BUT, here the answer is in Streamlit's documentation: st.experimental_rerun was deprecated in version 1.27.0. Use st.rerun instead.
You may need to downgrade if you want to use that attribute, or upgrade your code for the version you're using.