Callbacks don't work when using Template with `servable`

I am using depends to link a variable selector to a plot:

@pn.depends(variable=variable)
def copernicus_plot(variable):
    print(variable)

    /* create plot */
    return plot

I am displaying this plot in a Card which I am then adding to a bootstrap template:

copernicus_card = pn.Card(copernicus_plot)

But when I set my template to servable and launch it with panel serve, picking a value in the variable selector does not update the plot. It works fine if I show the template with show.

The final dashboard is created as follow:

copernicus_tab = pn.Column(
    description,
    copernicus_card,
)

dashboard = pn.Tabs(
    ("Copernicus Data", copernicus_tab),
    css_classes=["tabs"],
    max_width=1024,
)

page.main.append(dashboard)

page.sidebar.append(pn.Card(
    variable,
    title="Select an impact to show",
))

page.servable()

variable is a simple Selector as follows:

variable = pn.widgets.Select(options=[
    /* options */
])

I have also tried using callbacks as follows:

def copernicus_callback(target, event):
    logger.info("Callback: " + event.new)
    print("Callback: "+event.new)
    print(target)

copernicus_card = pn.Card(copernicus_plot)
variable.link(copernicus_card, {'value': copernicus_callback})
variable.value = "AD03"

But this doesn’t work either. The callback is called the first time the app is loaded but not on subsequent changes.

What am I doing wrong?

Hi @kamransoomro84

More information is needed in order to be able to help. Could you please provide a minimum reproducible example and the panel version you are using.

Thanks.