How to have non-shared session states

How do I write code that allows different session to have different states?
Currently, all my sessions are sychronized / share their states without explicitly coding it that way.

A minimum example:

import panel as pn
pn.extension()

dashboard = pn.Column('# Dashboard', 
                  pn.Tabs(pn.Spacer(), pn.Spacer(), pn.Spacer())
                 )

server = pn.serve(dashboard, start=True, show=True)

If I now open multiple sessions, even across clients (so different IPs), once I click a tab in one session, all other sessions switch the tab as well.

How do I get to a situation where sessions behave independently?

Two approaches, either use .servable() and launch the dashboard with panel serve or wrap the dashboard components in a function like this:

1 Like

The .servable() approach would cause some more trouble / restructuring with my real code.
But wrapping it in a function works just fine.
Thank you!

1 Like