code: def check_relative_reqs():
      """
      Check that relationships between handlers are defined correctly.
  
      If a parent handler imports another handler in code, we should define that dependency
      in the parent handler's requirements.txt like:
  
      -R mindsdb/integrations/handlers/child_handler/requirements.txt
  
      This is important to ensure that "pip install mindsdb[parent_handler]" works correctly.
      This function checks that for each handler imported from another handler, there is a
      corresponding entry in a requirements.txt.
      """
  
      global success
      # regex for finding relative imports of handlers like "from ..file_handler import FileHandler"
      # we're going to treat these as errors (and suggest using absolute imports instead)
      relative_import_pattern = re.compile(
          "(?:\s|^)(?:from|import) \.\.\w+_handler"
      )  # noqa: W605
  
      def get_relative_requirements(files):
          """Find entries in a requirements.txt that are including another requirements.txt"""
          entries = []
          for file in files:
              with open(file, "r") as fh:
                  for line in fh.readlines():
                      line = line.lower().strip()
                      if line.startswith(
                          "-r mindsdb/integrations/handlers/"
                      ):
                          entries.append(
                              line.split(
                                  "mindsdb/integrations/handlers/"
                              )[1].split("/")[0]
                          )  # just return
                          # the handler name
  
          return entries
  
      for handler_dir in glob.glob("mindsdb/integrations/handlers/*/"):
          handler_name = handler_dir.split("/")[-2].split("_handler")[0]
  
          # regex for finding imports of other handlers like "from mindsdb.integrations.handlers.file_handler import FileHandler"
          # excludes the current handler importing parts of itself
          import_pattern = re.compile(
              f"(?:\s|^)(?:from|import) mindsdb\.integrations\.handlers\.(?!{handler_name})\w+_handler"
          )  # noqa: W605
  
          # requirements entries for this handler that point to another handler's requirements file
          required_handlers = get_relative_requirements(
              [
                  file
                  for file in HANDLER_REQS_PATHS
                  if file.startswith(handler_dir)
              ]
          )
  
          all_imported_handlers = []
  
          # for every python file in this handler's code
          for file in glob.glob(
              f"{handler_dir}/**/*.py", recursive=True
          ):
              errors = []
  
              # find all the imports of handlers
              with open(file, "r") as f:
                  file_content = f.read()
                  relative_imported_handlers = [
                      match.strip()
                      for match in re.findall(
                          relative_import_pattern, file_content
                      )
                  ]
                  handler_import_lines = [
                      match.strip()
                      for match in re.findall(
                          import_pattern, file_content
                      )
                  ]
  
              imported_handlers = {
                  line: line.split("_handler")[0].split(".")[-1]
                  + "_handler"
                  for line in handler_import_lines
              }
              all_imported_handlers += imported_handlers.values()
  
              # Report on relative imports (like "from ..file_handler import FileHandler")
              for line in relative_imported_handlers:
                  errors.append(
                      f"{line} <- Relative import of handler. Use absolute import instead"
                  )
  
              # Report on imports of other handlers that are missing a corresponding requirements.txt entry
              for (
                  line,
                  imported_handler_name,
              ) in imported_handlers.items():
                  if imported_handler_name not in required_handlers:
                      errors.append(
                          f'{line} <- {imported_handler_name} not in handler requirements.txt. Add it like: "-r mindsdb/integrations/handlers/{imported_handler_name}/requirements.txt"'
                      )
  
              # Print all the errors for this .py file
              print_errors(file, errors)
  
          # Report on requirements.txt entries that point to a handler that isn't used
          requirements_errors = [
              required_handler_name
              for required_handler_name in required_handlers
              if required_handler_name not in all_imported_handlers
          ]
          print_errors(handler_dir, requirements_errors)
  
file_path: mindsdb/tests/scripts/check_requirements.py
imports: import glob
  import re
  import sys
  import subprocess
  import os
  import json
label_desc: Use image node_id 6 for calling a global function with example usage: check_relative_reqs() and returns: entries