Button inside button

Hello everyone,
I was trying to make sequence process in my app by clicking buttons, and I figure out that when I want to show a result for a button which is inside another button it doesn’t work, cloud anyone explain this issue to me
thanks in advance …

little lines to make it more clear

if st.button('1'):
    st.write('you clicked the first button')
    if st.button('2'):
        st.write('you clicked the second button')

( by clicking button 2 the page seems like refreshing )