code: def fill_modules():
      del pymodules[:]
      del badmodules[:]
      all_modules.clear()
      svn_revisions.clear()
  
      def add_module(mod, check_svn, class_name=None):
          try:
              m = __import__(mod, globals(), locals(), ["__all__"], 0)
              if class_name:
                  cp_module = m.__dict__[class_name]
                  assert issubclass(cp_module, Module)
              else:
                  cp_module = find_cpmodule(m)
              name = cp_module.module_name
          except Exception as e:
              LOGGER.warning("Could not load %s", mod, exc_info=True)
              badmodules.append((mod, e))
              return
  
          try:
              pymodules.append(m)
              if name in all_modules:
                  LOGGER.warning(
                      "Multiple definitions of module %s\n\told in %s\n\tnew in %s",
                      name,
                      sys.modules[
                          all_modules[name].__module__
                      ].__file__,
                      m.__file__,
                  )
              all_modules[name] = cp_module
              check_module(cp_module, name)
              # attempt to instantiate
              if not hasattr(cp_module, "do_not_check"):
                  cp_module()
              if check_svn and hasattr(m, "__version__"):
                  match = re.match(
                      "^\$Revision: ([0-9]+) \$$", m.__version__
                  )
                  if match is not None:
                      svn_revisions[name] = match.groups()[0]
          except Exception as e:
              LOGGER.warning("Failed to load %s", name, exc_info=True)
              badmodules.append((mod, e))
              if name in all_modules:
                  del all_modules[name]
                  del pymodules[-1]
  
      # Import core modules
      for modname, classname in builtin_modules.items():
          add_module(
              "cellprofiler_core.modules." + modname,
              True,
              class_name=classname,
          )
  
      # Import CellProfiler modules if CellProfiler is installed
      cpinstalled = False
      try:
          import cellprofiler.modules
  
          cpinstalled = True
      except ImportError:
          print(
              "No CellProfiler installation detected, only base modules will be loaded"
          )
      if cpinstalled:
          for (
              modname,
              classname,
          ) in cellprofiler.modules.builtin_modules.items():
              add_module(
                  "cellprofiler.modules." + modname,
                  True,
                  class_name=classname,
              )
  
      if len(badmodules) > 0:
          LOGGER.warning(
              "could not load these modules: %s",
              ",".join([x[0] for x in badmodules]),
          )
  
file_path: CellProfiler/src/subpackages/core/cellprofiler_core/utilities/core/modules/__init__.py
imports: import logging
  import os
  import re
  import sys
  from ....module import Module
  from ....constants.modules import do_not_override, should_override, all_modules, svn_revisions, pymodules, badmodules, builtin_modules, renamed_modules, unimplemented_modules, depricated_modules, replaced_modules
  from ..plugins import load_plugins
label_desc: Use image node_id 3 for calling a global function with example usage: fill_modules() without return types