code: def when_imported(name, error_handler=False):
      def register(hook):
          if error_handler:
              register_import_error_hook(hook, name)
          else:
              register_post_import_hook(hook, name)
          return hook
  
      return register
  
imports: import importlib
  import sys
  import threading
label_desc: Use image node_id 10 for calling a global function with example usage: when_imported(name, error_handler) and returns: register, hook