# Next button / open new page / session state

**URL:** <https://discuss.streamlit.io/t/next-button-open-new-page-session-state/14735>\
**Category:** Using Streamlit\
**Created:** [July 7, 2021, 10:51am UTC](https://discuss.streamlit.io/t/next-button-open-new-page-session-state/14735 "2021-07-07T10:51:30Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nainiayoub](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/nainiayoub/32/49924_2.png) [@nainiayoub](https://discuss.streamlit.io/u/nainiayoub)\
**Post date:** [July 7, 2021, 12:15pm UTC](https://discuss.streamlit.io/t/next-button-open-new-page-session-state/14735/2 "2021-07-07T12:15:17Z")

</div>

Hey @Isa ,

There is a workaround this without using session\_state. It will allow you to move through your radio in the sidebar by clicking on the next button like it was explained in [this solution](https://discuss.streamlit.io/t/navigation-panel-can-we-have-a-button-on-the-right-hand-side-like-next-which-automatically-moves-to-the-next-page-in-the-navigation-panel/6588).

To make it more clear for you I have customized the solution to respond to your request with this code:

```auto
import streamlit as st
import pickle as pkle
import os.path

pages = ['Page1','Page2','Page3']

if os.path.isfile('next.p'):
    next_clicked = pkle.load(open('next.p', 'rb'))
    if next_clicked == len(pages):
        next_clicked = 0 
else:
    next_clicked = 0 

if next:
    next_clicked = next_clicked+1
    if next_clicked == len(pages):
        next_clicked = 0 

choice = st.sidebar.radio("Pages",('Page1','Page2', 'Page3'), index=next_clicked)
pkle.dump(pages.index(choice), open('next.p', 'wb'))

if choice == 'Page1':
    st.title('Page 1')
elif choice == 'Page2':
    st.title('Page 2')
elif choice == 'Page3':
    st.title('Page 3')

next = st.button('Go to next page')

```

![pages](https://global.discourse-cdn.com/streamlit/original/2X/0/069726d2ed49a93cf8d3ada2d2fa24d452f97a39.png)

Let us know if this was helpful !

---

_[View the full topic](https://discuss.streamlit.io/t/next-button-open-new-page-session-state/14735)._
