title: Bokeh Server callback from tools
body: <p>I'm kinda new on Python, and currently working on a interactive plot visualization using Bokeh where I need to show multiple related charts. To accomplish this i'm using bokeh server.</p>
  
  <p>I've been reading the docs and <a href="https://demo.bokehplots.com/" rel="noreferrer">some examples</a> but i've been unable to find an example of a python callback (executed in the server) triggered by a selection on the plot. Basically what i would like to do is something like:</p>
  
  <pre><code>from bokeh.plotting import figure, curdoc
  from bokeh.layouts import column
  from bokeh.models import ColumnDataSource
  
  TOOLS = "tap"
  p = figure(title="Some Figure", tools=TOOLS)
  
  source = ColumnDataSource(dict(x=[[1, 3, 2], [3, 4, 6, 6]], y=[[2, 1, 4], [4, 7, 8, 5]], name=['A', 'B']))
  
  p.patches('x', 'y', source=source, color=["firebrick", "navy"], alpha=[0.8, 0.3], line_width=2)
  
  
  def callback():
      print("TapTool callback executed on Patch {}")
  
  
  ??? &lt;- some code here linking the taptool with the callback function defined above
  
  
  curdoc().add_root(column(p))
  </code></pre>
  
  <p>and then when executing the server and clicking on a patch:</p>
  
  <blockquote>
    <p>2017-02-14 16:32:00,000 TapTool callback executed on Patch A</p>
  </blockquote>
  
  <p>is this behavior something that can be achieved with bokeh?</p>