code: def process_cmds(module_globals):
      global _all_cmds, _all_cmds_dict, ENABLED_CMD, _TOGGLE_CMD
  
      _resolve_relative_paths(module_globals)
  
      _all_cmds = _get_ext_cmds(module_globals)
  
      try:
          modules_to_import = get_modules("cmd")
          # This is like multiload_all but we load globals independently since we just care
          # about the TOGGLE and ENABLED values
          for m in modules_to_import:
              for n, o in m.module.__dict__.items():
                  if n == "TOGGLE_CMD":
                      _TOGGLE_CMD.extend(o)
                  elif n == "ENABLED_CMD":
                      ENABLED_CMD = o
              _resolve_relative_paths(m.module.__dict__)
              _all_cmds.extend(_get_ext_cmds(m.module.__dict__))
      except Exception as e:
          _ext_debug(
              "\tWARNING: ignoring all cmds due to error during import: %s"
              % e
          )
          print(
              "WARNING: Cmds did not load -- ignoring all of them which may not "
              "be what you want: %s" % e
          )
          traceback.print_exc()
  
      # At this point, we have _all_cmds populated with all the tuples
      # (name, module_class) from all the cmds in all the extensions (if any)
      # We build a dictionary taking the latest presence for each name (so plugins
      # override metaflow core)
      for name, class_path in _all_cmds:
          _ext_debug(
              "    Adding command '%s' from '%s'" % (name, class_path)
          )
          _all_cmds_dict[name] = class_path
  
      # Resolve the ENABLED_CMD variable. The rules are the following:
      #  - if ENABLED_CMD is non None, it means it was either set directly by the user
      #    in a configuration file, on the command line or by an extension. In that case
      #    we honor those wishes and completely ignore the extensions' toggles.
      #  - if ENABLED_CMD is None, we populate it with everything included here and in
      #    all the extensions and use the TOGGLE_ list to produce the final list.
      # The rationale behind this is to support both a configuration option where the
      # cmds enabled are explicitly listed (typical in a lot of software) but also to
      # support a "configuration-less" version where the installation of the extensions
      # determines what is activated.
      if ENABLED_CMD is None:
          ENABLED_CMD = list(_all_cmds_dict) + _TOGGLE_CMD
  
file_path: metaflow/metaflow/extension_support/cmd.py
imports: import importlib
  import traceback
  from metaflow.metaflow_config_funcs import from_conf
  from .None import _ext_debug, get_modules
label_desc: Use image node_id 1 for calling a global function with example usage: process_cmds(module_globals) without return types