Adding plot.toolbar.active_scroll = plot.select_one(WheelZoomTool) raises error

Adding plot.toolbar.active_scroll = plot.select_one(WheelZoomTool) in def update_plot(attr, old, new) function raises following error:

ValueError: Found more than one object matching <class ‘bokeh.models.tools.WheelZoomTool’>: [WheelZoomTool(id=‘1046’, …), WheelZoomTool(id=‘1275’, …)]

sample code:

plot = figure()
plot.tools = [PanTool(), hover, WheelZoomTool()]
plot.toolbar.active_scroll = plot.select_one(WheelZoomTool)
some other codes
def update_plot(attr, old, new):
         some other codes
         plot.toolbar.active_scroll = plot.select_one(WheelZoomTool)

@Cna The select_one is intended to raise an error if call it and there is more than one possible value to return.[1] Are you sure you are not adding a second WheelZoomTool somewhere show? If not, we would need a Minimal Reproducible Example to actually run and investigate.


  1. In cases where multiple return values are expected or intended, you can use select instead, to get a list of all the matching values. But it seems unlikely to ever intentionally add multiple wheel zoom tools to a single plot. ↩︎