Control added WMTS

Hello all!

I am trying to control visibility of WMTSTileSource layers with a radio button in a bokeh server app. What I want is to switch from one wms layer to the other by clicking a different radio button option.

What I did so far is set up a list of wms layers, add these with add_tile and group the handles in a list. Upon radio button callback, I set visible to False. The callback works fine as I print the result just to check. Whatever I do, both layer are always visible! Does anyone know how I should do this? Code snippets are as follows:

Setting up of the wms layers

p = figure(plot_height=550, plot_width=900)
wms = []
for url, attribution in zip(urls, attributions):
    bkg_tile = WMTSTileSource(url=url,

Setup of radiogroup

# Widgets and callbacks
radio_group = RadioGroup(
    labels=url_names, active=0)
radio_group.on_change('active', radio_group_change)

Callback (including check on the status of the visible property afterwards)

def radio_group_change(attrname, old, new):

def update_background():
    print('Active layer is {:d}'.format(
    for n, w in enumerate(wms):
        if n ==
            w.visible = True
            w.visible = False

    print('Layer 1 is {:s}'.format(str(wms[0].visible)))
    print('Layer 2 is {:s}'.format(str(wms[1].visible)))