code: def setup_imports():
      from mmf.common.registry import registry
  
      # First, check if imports are already setup
      has_already_setup = registry.get("imports_setup", no_warning=True)
      if has_already_setup:
          return
      # Automatically load all of the modules, so that
      # they register with registry
      root_folder = registry.get("mmf_root", no_warning=True)
  
      if root_folder is None:
          root_folder = os.path.dirname(os.path.abspath(__file__))
          root_folder = os.path.join(root_folder, "..")
  
          environment_mmf_path = os.environ.get(
              "MMF_PATH", os.environ.get("PYTHIA_PATH")
          )
  
          if environment_mmf_path is not None:
              root_folder = environment_mmf_path
  
          registry.register("pythia_path", root_folder)
          registry.register("mmf_path", root_folder)
  
      trainer_folder = os.path.join(root_folder, "trainers")
      trainer_pattern = os.path.join(trainer_folder, "**", "*.py")
      datasets_folder = os.path.join(root_folder, "datasets")
      datasets_pattern = os.path.join(datasets_folder, "**", "*.py")
      model_folder = os.path.join(root_folder, "models")
      common_folder = os.path.join(root_folder, "common")
      modules_folder = os.path.join(root_folder, "modules")
      model_pattern = os.path.join(model_folder, "**", "*.py")
      common_pattern = os.path.join(common_folder, "**", "*.py")
      modules_pattern = os.path.join(modules_folder, "**", "*.py")
  
      import mmf.common.meter
  
      files = (
          glob.glob(datasets_pattern, recursive=True)
          + glob.glob(model_pattern, recursive=True)
          + glob.glob(trainer_pattern, recursive=True)
          + glob.glob(common_pattern, recursive=True)
          + glob.glob(modules_pattern, recursive=True)
      )
  
      for f in files:
          f = os.path.realpath(f)
          if f.endswith(".py") and not f.endswith("__init__.py"):
              splits = f.split(os.sep)
              import_prefix_index = 0
              for idx, split in enumerate(splits):
                  if split == "mmf":
                      import_prefix_index = idx + 1
              file_name = splits[-1]
              module_name = file_name[: file_name.find(".py")]
              module = ".".join(
                  ["mmf"]
                  + splits[import_prefix_index:-1]
                  + [module_name]
              )
              importlib.import_module(module)
  
      registry.register("imports_setup", True)
  
file_path: mmf/mmf/utils/env.py
imports: import glob
  import importlib
  import logging
  import os
  import random
  import sys
  from datetime import datetime
  import numpy
  import torch
  from omegaconf import OmegaConf, open_dict
label_desc: Use image node_id 4 for calling a global function with example usage: setup_imports() without return types