I am looking at how to load an external JS URL in a Google Colab notebook once and have it be available in all subsequent cells.
It seems that Google Colab uses a different worker thread or other isolation for each notebook cell. This means that doing something like the solution found in Is it impossible to load a javascript library in a Google colab cell? to load external libraries in one cell works for that cell:
from IPython.display import display, Javascript
display(Javascript(url="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"))
display(Javascript('''console.log($);'''))
but move to the next cell and run:
display(Javascript('''console.log($);'''))
and console will report undefined variable: $.
I have tried setting the variable in Window and globalThis to no avail. Anyone have success?
(The library I need is not JQuery. Just using it as an example)