Skip to main content

ImportStatementPackage AST Python Object

The ImportStatementPackage object matches a Python import.

The astType value for this node is importpackage.

Code Pattern

This object catches the parts package1 or package2 as asname in the following code pattern

import package1, package2 as asname

Attributes

  • name (type AstString): name of the imported package
  • as (type AstString): if package is renamed, this captures the as part of the import. Otherwise, the value is null.

See also