get_kernel_id
Returns the kernel id, a unique string for each virtual kernel.
def get_kernel_id(ipython_fallback=True) -> str:
...
See Understanding solara server for understanding the concept of virtual kernels and their lifetime.
This unique ID can be useful to to implement storing state, scoped to a kernel. See the scope example for an example.
If ipython_fallback
is True
(default), this function will also work in IPython notebooks, where it will return the IPython kernel id.