Sidebar Radio button - every option uses a script with an input parameter for the page name

Hi everyone.

I have the following conundrum.

I have built a script pages.py which has a which takes the page name as an input ‘def app(page_name):’. this selects the information for the relevant page I want to display.

I also have an app.py with a sidebar radio button which looks like this

if selection == “Home”:
home.app()
elif selection == “Common”:
pages.app(page_name = ‘Common’)
elif selection == “Data collection”:
pages.app(page_name = ‘Data Collection’)

So essentially the panels on Common and Data Collection are the same, it’s just numbers that change. When you go into Common and work your way down to the page, you get to a ‘Submit’ button which writes some data back to a spreadsheet. This works fine, however, once I select ‘Data Collection’, the page loaded starts from the place where I previously stopped, i.e. not the beginning of the page. I don’t think this is related to cookies. How can I make sure the next page loaded will start from the top?

Thanks.