There's definitely some misunderstanding to correct. CustomJS.from_py_func is a convenience that "translates" a python function into JavaScript, that gets run in the browser. But the code in the function can't do anything that JavaScript in the browser can't do. In particular, global can't function at all, because only things completely in the function get translated and make it to JavaScript. The code in the browser knows nothing at all about "is_sub_plot_display".
It's not quite clear what you are trying to accomplish at a high level, so I can't really offer more specific guidance.
thanks a lot for those valuable feedback. If I do need a global variable to implement my logic, what suggestion? cheers.
···
On Friday, June 8, 2018 at 3:34:07 PM UTC-6, Bryan Van de ven wrote:
Hi,
There’s definitely some misunderstanding to correct. CustomJS.from_py_func is a convenience that “translates” a python function into JavaScript, that gets run in the browser. But the code in the function can’t do anything that JavaScript in the browser can’t do. In particular, global can’t function at all, because only things completely in the function get translated and make it to JavaScript. The code in the browser knows nothing at all about “is_sub_plot_display”.
It’s not quite clear what you are trying to accomplish at a high level, so I can’t really offer more specific guidance.
On Friday, June 8, 2018 at 3:34:07 PM UTC-6, Bryan Van de ven wrote:
Hi,
There’s definitely some misunderstanding to correct. CustomJS.from_py_func is a convenience that “translates” a python function into JavaScript, that gets run in the browser. But the code in the function can’t do anything that JavaScript in the browser can’t do. In particular, global can’t function at all, because only things completely in the function get translated and make it to JavaScript. The code in the browser knows nothing at all about “is_sub_plot_display”.
It’s not quite clear what you are trying to accomplish at a high level, so I can’t really offer more specific guidance.