Menu between multipages - Calling st.rerun() within a callback is a no-op

Tried to create a on-change menu using

selected5 = option_menu(None, ["Home", "Upload", "Tasks", 'Settings'],
                            icons=['house', 'cloud-upload', "list-task", 'gear'],
                            on_change=update_new, key='menu_5', orientation="horizontal")
    selected5

and call switch_model inside the callback function, which produced the warning: Calling st.rerun() within a callback is a no-op.
Anyway to overcome this?

As the error suggests, any function assigned to a callback cannot contain a rerun command. Callbacks are something that occur at the beginning of a page rerun. What is contained within your callback function?

The recommendation would be to rework the callback so that it does not contain a callback. It would help to have a minimal, reproducible, executable snippet to understand what is happening.