Changing page

I need to change page page depending on a variable value.
For example if x = 1 it will change the app to another page.
I can do it with button I know but I need it to be automatically without button.
Thanks in advance

You can do with with streamlit-extras

import streamlit as st
from streamlit_extras.switch_page_button import switch_page

x = st.slider("x", 0, 10)

if x == 1:

Is there any documentation of how to make the second page?

If you create a pages folder next to your file, then any .py file in the pages folder will be another page.