Using asyncio in custom extenstion but not working in usd composer app

i develop a customer extension by using kit-app-template repo (NVIDIA-Omniverse/kit-app-template: Omniverse Kit App Template) and i use asyncio for handle api query and streaming data.
everything in workable in my-app(also developed by kit-app-template) + my-extension.

however, i want to use the extension in USD composer
it’s not working
the error shows “there is no current event loop in thread MainThread”
and i can’t close the USD composer window, too.(need to terminate through task-manager)

i had try some method but still can not solve the problem. so i want to ask if there’s any suggestion?

thanks for the information.

below is the code in extension.py and error.log file

def on_click_trigger_sumo_api(self, action):
    asyncio.run(SUMO.post_sumo_action(self.sumo_project_label.text, action))
 
def on_click_get_sumo_streaming(self):
    run_loop = asyncio.get_event_loop()
    run_loop.create_task(SUMO.get_sumo_streaming(self.sumo_project_label.text))

kit_20250117_114158.log (2.2 MB)

Let me see if I can get someone to help with this

Sorry for the delay. It seems you may have encounted a bug in our template that we will need to fix. A ticket has been made to fix and track this.

First of all, here is a document link on using Asyncio Usage Examples — Omniverse Kit

Second we see an error in your log that there is no loop in your main code. This is the bug we are looking into
[Error] [omni.ui.python] RuntimeError: There is no current event loop in thread ‘MainThread’.

thanks for the reply.
and want to make sure can i receive the update once the ticket be solved?

Yes once this is fixed it will be in the next version of Kit

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.