I would like to call the function say_hello
in Jupyter Notebook.
def say_hello():
print('hello')
%%javascript
//What have been tried
// Method 1
var kernel = IPython.notebook.kernel;
kernel.execute("say_hello()", {"output": callback});
// Method 2
Jupyter.notebook.kernel.execute("say_hello()")
Both methods throw ReferenceError
in the browser console.
VM5326:7 Uncaught ReferenceError: IPython is not defined
at send_message (<anonymous>:7:22)
at onClickSendMessage (<anonymous>:12:9)
at HTMLButtonElement.onclick (app.ipynb:1)
version : JupterLab 3.5, IPython 7.16, Python 3.9.1
from Cannot call Python function from Javascript in Notebook
No comments:
Post a Comment