asyncio.run cannot be called from a running event loop code example
Example: asyncio.run() cannot be called from a running event loop from jupyterlab
import asyncio
def wait_for_change(widget, value):
future = asyncio.Future()
def getvalue(change):
# make the new value available
future.set_result(change.new)
widget.unobserve(getvalue, value)
widget.observe(getvalue, value)
return future