Get widget by name via python (not javascript-CustomJS)

I would like to link two (or more) widget values. That is, if the user interacts with a given widget, I would like to change accordingly the value of another widget (or disable that widget). I guess this could be done via the property “name”. However, I would like to do so via a python callback (not javascript code). Is that possible?

=============

def foo_callback(attr, old, new):
???
return ?

foo_spinner = Spinner(
title=“Foo spinner”,
low=1, high=100,
step=1, value=1, width=300,
)
foo_spinner.on_change(‘value’, foo_callback)

foo_check_box = CheckboxGroup(labels=‘I am a happy check box’, active=)

===================
Say, I want to deactivate foo_spinner when the foo_check_box is not active (not selected). I would also like to set the value of foo_spinner equal to 30 when foo_check_box is activated (selected by the user)
Any suggestion?

Thank you in advance!

Themis

Please see the docs for the args dict in the docs: JavaScript callbacks — Bokeh 2.4.3 Documentation

There are very many examples in the repo that demonstrate the args dict, as well.

Lastly, in the future, please use code formatting so that the code is intelligible (either with the </> icon on the editing toolbar, or triple backtick ``` fences around the code blocks)

Thank you for your reply!
However, I am interested to a solution with python, not Javascript.

Then you don’t need to do anything. Just define the widgets before any callback functions, then you can access (and thus manipulate) the widgets inside the callbacks per standard python scoping rules.