This metric measures the number of modules that are imported by each module (file) - either directly by an import statement or indirectly (that is, imported by a module that is imported). Modules that import many other modules often have too many responsibilities and are not well-focused. This makes it difficult to understand and maintain the module.

Split and/or refactor files with too many responsibilities to create modules with a single, well-defined role.

  • Python Language Reference: The import statement.
  • M. Fowler, Refactoring. Addison-Wesley, 1999.
  • Wikipedia: Code refactoring.