Omniverse Kit 107.3: next_update_async + lambda → TypeError: observer_name must be str, not function (async panel build bug)

Hi all,

Environment:

  • Omniverse Kit SDK: 107.3+
  • Windows 10/11
  • Python-based UI extension (custom panels, asyncio, etc.)

Issue Summary:
When building UI panels asynchronously in Omniverse Kit 107.3 using the recommended pattern:

python

CopyEdit

asyncio.ensure_future(get_app().next_update_async(lambda: self._build_grid(parent_stack)))

Kit throws a TypeError in the core event dispatcher during startup:

python

CopyEdit

TypeError: observe_event(): incompatible function arguments.
The following argument types are supported:
    1. (self: carb.eventdispatcher._eventdispatcher.IEventDispatcher, order: int = 0, event_name: str, on_event: Callable[[carb.eventdispatcher._eventdispatcher.Event], None], filter: handle = None, observer_name: str = '<python>') -> carb.eventdispatcher._eventdispatcher.ObserverGuard

Invoked with: ..., 50, 'update', <function ...>, observer_name=<function UISystemAdminPanel.__init__.<locals>.<lambda> at 0x...>

What’s Happening:

  • Passing a lambda to next_update_async causes the Kit event system to set the lambda itself as observer_name (should be a string).
  • This breaks the expected signature and raises a TypeError in Kit’s internal event loop, killing the panel/UI async build.

What I Tried:

  • Wrapping with a lambda (standard async UI pattern): crashes.
  • Building grid synchronously: works, but causes UI thread blocking for large/complex panels.
  • Using a named function instead of a lambda: solves the error!

Workaround / Solution:
Replace the lambda with a named function:

python

CopyEdit

def build_grid_callback():
    self._build_grid(parent_stack)
asyncio.ensure_future(get_app().next_update_async(build_grid_callback))

This makes the observer name a real string (from the function’s __name__), and Kit’s event dispatcher works as expected.

Request:

  • Please document this limitation/bug with next_update_async and lambda usage in the Kit UI API docs.
  • If possible, update Kit so that lambdas (or any function objects) are converted to string names for observer_name, or provide a more helpful error.

References / Example Stack:

  • Extension loads fine with a named callback.
  • Using lambda always triggers the error above, even with trivial callback logic.

Thanks for any additional insight or ETA for a Kit-side patch!


Chris Wirth
(Multi-Agent Pipeline Extension Dev)

Ok, this is a very advanced level of code. I appreciate you raising this issue, but I am not clear if this is a bug. You say that if you pass a “lamda” it breaks but if you send a “name function” instead it works. So, does that not just suggest a simple syntax error you can avoid? The work around you found seems to be the correct method. So then, what makes you think this is a bug? If the code was designed to pass a named function, and it works, I am not sure saying it does not accept a lamda, would be considered a bug. Just a limitation of the way it was written. I am just asking to understand.

What exactly is the reason for needing to pass a lamda over a named function? Does it break your workflow?

Hello,

I’m writing to clarify and document an issue I’ve encountered with the Omniverse Kit SDK (version 107.3) concerning the use of lambda functions as callbacks in asynchronous UI builds, specifically using the method next_update_async.

Issue Summary:
When using a lambda function as a callback with next_update_async, Kit’s internal event dispatcher throws the following TypeError:

python

TypeError: observe_event(): incompatible function arguments.
The following argument types are supported:
1. (self: carb.eventdispatcher._eventdispatcher.IEventDispatcher, order: int = 0, event_name: str, on_event: Callable[[carb.eventdispatcher._eventdispatcher.Event], None], filter: handle = None, observer_name: str = ‘’) → carb.eventdispatcher._eventdispatcher.ObserverGuard

Invoked with: …, 50, ‘update’, <function …>, observer_name=<function UISystemAdminPanel.init.. at 0x…>


**What’s Causing This?**
Internally, Kit attempts to register the callback's name as a string (`observer_name`). However, lambdas inherently lack meaningful string names (`__name__` is always `<lambda>`), leading Kit to incorrectly assign the lambda object itself as the observer name, which triggers the error.

**Current Workaround:**
Replacing the lambda with a named function resolves the issue entirely:

python



def build_grid_callback():
self._build_grid(parent_stack)

asyncio.ensure_future(get_app().next_update_async(build_grid_callback))


This solution confirms that the Kit event dispatcher currently requires callbacks to be explicitly named functions.

**Is this a Bug or Limitation?**
This seems more like a current limitation in the SDK rather than a strict bug, given that Kit expects named functions. However, lambdas are commonly used and recommended in asynchronous Python coding patterns, so improving Kit’s internal handling would be very beneficial.

**Recommendations:**

* Clearly document this limitation regarding lambda callbacks in the Kit SDK documentation.
* Alternatively, enhance the Kit event dispatcher internally to gracefully handle lambdas by converting their name attribute to the string `"<lambda>"`, preventing ambiguous TypeErrors.

I hope this provides clear insight into the issue and helps improve the Omniverse Kit experience for everyone.

Thank you very much for your consideration.

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