code: def check_module_imports(self, module_path, root_dir):
      with open(module_path, "r") as f:
          node = ast.parse(f.read())
  
      imports = [
          n
          for n in ast.walk(node)
          if isinstance(n, (ast.Import, ast.ImportFrom))
      ]
      for imp in imports:
          try:
              if isinstance(imp, ast.Import):
                  for name in imp.names:
                      importlib.import_module(name.name)
              elif isinstance(imp, ast.ImportFrom):
                  importlib.import_module(imp.module)
          except ImportError as e:
              missing_package = (
                  str(e).split("No module named ")[-1].strip("'")
              )
              local_requirements_path = os.path.join(
                  root_dir, "requirements.txt"
              )
              if not (
                  self.is_in_requirements(
                      missing_package, local_requirements_path
                  )
                  or self.is_in_requirements(
                      missing_package, MAIN_REQUIREMENTS_PATH
                  )
              ):
                  logging.warning(
                      f"Invalid import in {module_path}: {e}"
                  )
                  return False
          except Exception as e:
              logging.warning(f"Issue with {module_path}: {e}")
              return False
      return True
  
file_path: mindsdb/tests/unit/test_check_handler_imports.py
imports: import ast
  import importlib
  import logging
  import os
  import unittest
  from pathlib import Path
label_desc: Use image node_id 2 for calling the TestPackageImports obj's underlying member method code with example usage: obj.check_module_imports(module_path, root_dir) and returns: True, False, False