Language Syntax

Import — Python syntax

Load a module if needed and bind names in the current namespace. Importing a submodule without as binds the top-level package; from-import binds the requested object. Imports may execute module code.

Formal Syntax & Structure

python syntaxpython
import module as alias; from module import name as alias

Working Example

Example Snippetpython
import math as mfrom math import sqrt as rootprint((m.floor(2.8),root(16)))
Python Reference