{ } Raw JSON

bundles / traitlets 5.16.2 / traitlets / utils / importstring / import_item

function

traitlets.utils.importstring:import_item

source: /traitlets/utils/importstring.py:12

Signature

def import_item(name: str) → Any

Summary

Import and return bar given the string foo.bar.

Extended Summary

Calling bar = import_item("foo.bar") is the functional equivalent of executing the code from foo import bar.

Parameters

name : string

The fully qualified name of the module/package being imported.

Returns

mod : object

The imported object: for a dotted name foo.bar, the bar attribute of module foo (which may be any object); for an un-dotted name, the module itself.

Aliases

  • traitlets.import_item