Extension IntercommunicationΒΆ

Your extension can communicate with an instance of another loaded extension if they provide the proper mechanism. In this example, the controlling extension will set a flag in the helper extension to tell it to start its helping functionality, and whether it should run with or without a UI


Also see Creating Custom Events

Controlling Extension

import omni.docs.helper

class ControllerExtension(omni.ext.IExt):

   def on_startup(self, ext_id):
      helper_inst = omni.docs.helper.get_instance()
      if helper_inst:
         # tell helper to run headless (no ui)
         helper_inst.b_headless = True
         helper_inst.b_start_helping = True

Helper Extension

# give parent extension the ability to tell us
# to start helping and whether to run with or without UI
_extension_instance = None
def get_instance():
   return _extension_instance

class HelperExtension(omni.ext.IExt):

   def on_startup(self, ext_id):

      global _extension_instance
      _extension_instance = self