code: def import_func_from_source(
      source_path: str, fn_name: str
  ) -> Callable:  # pylint: disable=g-bare-generic
      """Imports a function from a module provided as source file."""
  
      # If module path is not local, download to local file-system first,
      # because importlib can't import from GCS
      source_path = io_utils.ensure_local(source_path)
  
      module = None
      with _imported_modules_from_source_lock:
          if (
              _tfx_module_finder.get_module_name_by_path(source_path)
              is None
          ):
              # Create a unique module name.
              module_name = (
                  "user_module_%d" % _tfx_module_finder.count_registered
              )
              logging.info(
                  "Loading source_path %s as name %s "
                  "because it has not been loaded before.",
                  source_path,
                  module_name,
              )
              try:
                  loader = importlib.machinery.SourceFileLoader(
                      fullname=module_name,
                      path=source_path,
                  )
                  spec = importlib.util.spec_from_loader(
                      loader.name, loader, origin=source_path
                  )
                  module = importlib.util.module_from_spec(spec)
                  sys.modules[loader.name] = module
                  loader.exec_module(module)
                  _tfx_module_finder.register_module(
                      module_name, source_path
                  )
              except IOError:
                  raise ImportError(
                      "{} in {} not found in "
                      "import_func_from_source()".format(
                          fn_name, source_path
                      )
                  )
          else:
              logging.info(
                  "%s is already loaded, reloading", source_path
              )
              module_name = _tfx_module_finder.get_module_name_by_path(
                  source_path
              )
              module = sys.modules[module_name]
              importlib.reload(module)
      return getattr(module, fn_name)
  
file_path: tfx/tfx/utils/import_utils.py
imports: import importlib
  import importlib.abc
  import sys
  import threading
  from typing import Any, Callable, Type
  from absl import logging
  from tfx.utils import io_utils
label_desc: Use image node_id 3 for calling a global function with example usage: import_func_from_source(source_path, fn_name) and returns: getattr