I have two separate bokeh python scripts. One which creates several documents, pdf’s, excel notebooks, cvs files, and a standalone bokeh html through the output_file() and show() commands. The second script is a bokeh server web app that acts as a GUI and visualizer of some data inputs (it does have python code callbacks).
The plotting script takes two pandas dataframes (in my example below are two lists for simplification), and a string as inputs. Which I’m trying to supply with the GUI script. I’d like to link both processes, however when running the plotting code through the GUI script, the output_file() and show() commands are ignored rendering the script useless.
Are there any alternatives to make the link between these two scripts?
I’ve tried just importing the script to the GUI, but that didn’t work. I’m considering using a subprocess to handle the inputs to a fresh process, but that has its own challenges.
from bokeh.models.widgets import Button from bokeh.io import curdoc import Test_Plotting def callback(): A = [0,1,2,3,4,5,6,7,8,9] B = [0,0,0,0,2,2,2,1,1,0] Test_Plotting.create_report(A,B,'my_report') gen_report = Button(label = "Execute Report") gen_report.on_click(callback) curdoc().add_root(gen_report)
from bokeh.plotting import figure, output_file, show def create_report(a,b,report_name): output_file(report_name) plt = figure() plt.line( x = a, y = b) show(plt) return plt