code: def import_all_packages_from_directory(root: str) -> None:
      """Automatically imports all packages under the root directory.
  
      For instance, if your directories look like:
          root / foo / __init__.py
          root / foo / abc.py
          root / bar.py
          root / baz / xyz.py
  
      This function will import the package foo, but not bar or baz."""
  
      for file in os.listdir(root):
          # Try to import each file in the directory. Our previous implementation
          # would look for directories here and see if there's a __init__.py
          # under that directory, but that turns out to be unreliable while
          # running on AWS: EFS filesystems cache metadata bits so the directory
          # and existence checks fail even when the import succeeds. We should
          # find a better workaround eventually, but this will do for now.
          try:
              file = Path(file)
              module_name = file.name
              # Dots have special meaning in Python packages -- it's a relative
              # import or a subpackage. Skip these.
              if (
                  "." not in module_name
                  and module_name not in sys.modules
              ):
                  logging.debug(
                      f"Automatically importing {module_name}"
                  )
                  importlib.import_module(module_name)
          except ModuleNotFoundError:
              pass
  
imports: import importlib
  import logging
  import os
  import sys
  from pathlib import Path
label_desc: Use image node_id 2 for calling a global function with example usage: import_all_packages_from_directory(root) without return types