Access Extension Instance from other Extension

Hi all,

how would I manage to let two different extensions (A and B) talk to each other? I would like to use the member function foo of extension A from within function bar in extension B. How would I do that? To be specific, I would like to access the already running instance of Extension A. I don’t want to create a new instance of A.

Example / more details:
Extension A:

  • can spawn prims on the stage.
  • maintains a list of all the prims that were created with Extension A.
  • foo: using that list, Extension A can delete all the prims, that it once spawned on the stage.

Extension B:

  • bar: needs call the foo function of A so that all the prims are deleted that were created by the running instance of Extension A.

Cheers

Markus

Hi @markus-franz.ziegler. There are lots of different ways that you can implement interactions between two extensions. The way you describe is just one of them, so I thought I’d list out a few different options for you though maybe not all of them are appropriate for your specific use case.

  1. Make Extension A a singleton. See omni.kit.window.file_importer’s implementation for an example. (This is specifically what you were asking about).
  2. Call a Kit Command that Extension A defines.
  3. Call a Kit Action that Extension A defines.
  4. Have Extension A listen for a custom event and have Extension B trigger the event: Events — Omniverse Kit documentation
  5. Have Extension A listen for a custom setting change and have Extension B change the setting.
1 Like

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