import-python-web

py_import(name)

import a python module

Arguments
  • name (string()) – the name of the module

Returns

Object – the module

// import the module to a single variable
const itertools = py_import('itertools')

// destructuring assignment to import the different functions or classes
const { permutations, combinations } = py_import('itertools')
py_import_star(name)

import all functions and classes from a module into the current namespace

Arguments
  • name (string()) – the module

// only recommended for the core python module but can be used for any module
py_import_star('core')