[section boost/python/import.hpp] [section Introduction] Exposes a mechanism for importing python modules. [endsect] [section Function `import`] ``object import(str name);`` [variablelist [[Effects][Imports the module named by name.]] [[Returns][An instance of object which holds a reference to the imported module.]] ] [endsect] [section Examples] The following example demonstrates the use of import to access a function in python, and later call it from within C++. `` #include #include using namespace boost::python; void print_python_version() { // Load the sys module. object sys = import("sys"); // Extract the python version. std::string version = extract(sys.attr("version")); std::cout << version << std::endl; } `` [endsect] [endsect]