code: def disc_modules(module_name, ignore_import_errors=False):
      
      if not ignore_import_errors:
          module = import_module(module_name)
      else:
          try:
              module = import_module(module_name)
          except BaseException:
              traceback.print_exc()
              return
  
      yield module
  
      if getattr(module, '__path__', None):
          for _, name, _ in pkgutil.iter_modules(module.__path__, module_name + '.'):
              for item in disc_modules(name, ignore_import_errors=ignore_import_errors):
                  yield item
docs: Recursively import a module and all sub-modules in the package
  
      Yields
      ------
      module
          Imported module in the package tree