ipylab
ipylab copied to clipboard
list_commands() not working

The command returns an empty list [].
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
@jtpio Thanks! Will try that.
@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))