code: def load_plugin(source, modules_only=False):
      try:
          m = importlib.import_module(source)
          pymodules.append(m)
          available_classes = inspect.getmembers(
              m,
              lambda member: inspect.isclass(member)
              and member.__module__ == m.__name__,
          )
          for name, plugin_class in available_classes:
              if issubclass(plugin_class, Module):
                  add_module(plugin_class)
                  break
              elif modules_only:
                  continue
              elif issubclass(plugin_class, Reader):
                  add_reader(plugin_class)
                  break
          else:
              LOGGER.warning(
                  f"Could not find Module{' or Reader' if not modules_only else ''} class in {m.__file__}"
              )
      except Exception as e:
          if not modules_only:
              # Figure out and store Reader class name, if present
              spec = importlib.util.find_spec(source)
              with open(spec.origin) as fd:
                  for line in fd:
                      if line.endswith("Reader):\n"):
                          result = re.search(
                              r".*class (?P<classname>.*)\(.*Reader\)",
                              line,
                          )
                          if result:
                              reader_name = result.group("classname")
                              BAD_READERS[
                                  reader_name
                              ] = traceback.format_exc()
                          break
                      elif line.endswith("Module):\n"):
                          break
          LOGGER.warning("Could not load %s", source, exc_info=True)
          return
  
imports: import glob
  import importlib
  import importlib.util
  import inspect
  import logging
  import os
  import re
  import sys
  import traceback
  from cellprofiler_core.constants.modules import all_modules
  from cellprofiler_core.constants.modules import pymodules
  from cellprofiler_core.constants.reader import ALL_READERS, BAD_READERS, AVAILABLE_READERS
  from cellprofiler_core.preferences import get_plugin_directory, config_read_typed
  from cellprofiler_core.module import Module
  from cellprofiler_core.reader import Reader
label_desc: Use image node_id 3 for calling a global function with example usage: load_plugin(source, modules_only) without return types