Update same instance of widget on multiple tabs

Hi :slight_smile:

I wanted to have the same instance of a widget on multiple tabs. However I have so difficulties to update it… I made minimal example bellow :

Whole code executed before display

import panel as pn
pn.extension()
gspec = pn.GridSpec(width=800, height=600, mode="override")
gspec[:,   0  ] = pn.Spacer(background='red',    margin=0)
gspec[0,   1:3] = pn.Spacer(background='green',  margin=0)
gspec[1,   2:4] = pn.Spacer(background='orange', margin=0)
gspec[2,   1:4] = pn.Spacer(background='blue',   margin=0)
gspec[0:1, 3:4] = pn.Spacer(background='purple', margin=0)

tabs = pn.Tabs(("test1", gspec), ("test2", gspec))
tabs.show(threaded=True)
gspec[:,   0  ] = pn.Spacer(background='blue',    margin=0)

On this example, the first column in tabs test1and test2 will be change to blue.


Modifications after displaying widgets

Howerver… If I first instance everything

import panel as pn
pn.extension()

gspec = pn.GridSpec(width=800, height=600, mode="override")

gspec[:,   0  ] = pn.Spacer(background='red',    margin=0)
gspec[0,   1:3] = pn.Spacer(background='green',  margin=0)
gspec[1,   2:4] = pn.Spacer(background='orange', margin=0)
gspec[2,   1:4] = pn.Spacer(background='blue',   margin=0)
gspec[0:1, 3:4] = pn.Spacer(background='purple', margin=0)

tabs = pn.Tabs(("test1", gspec), ("test2", gspec))

tabs.show(threaded=True)

Now I click both tabs, and then in a second time I update the colors with

gspec[:,   0  ] = pn.Spacer(background='blue',    margin=0)

Only the first rectangle in tab test2 will be blue. (I’m on Panel 0.13)

Is this a bug or do I use the widgets wrongly :slight_smile: ?

Thank you for your help!
Best,
Thibault.