list_commands() not working
smith558 opened this issue · comments
Stanislav (Stanley) Modrak commented
Jeremy Tuloup commented
Right, this is because the frontend might not be ready since everything is being executed in a single execute request.
Maybe using on_ready
can help: https://github.com/jtpio/ipylab/blob/main/examples/commands.ipynb
Stanislav (Stanley) Modrak commented
@jtpio Thanks! Will try that.
artttt commented
@jtpio
I've recently found a way of doing this without needing the callback and waits for the frontend to be ready in a single request.
from ipylab import JupyterFrontEnd
from jupyter_ui_poll import run_ui_poll_loop
app = JupyterFrontEnd()
func = lambda: None if app.commands.list_commands() == [] else app.commands.list_commands()
print (run_ui_poll_loop(func))