Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Py.ImportSourceImporting Modules
Wrapper for PyImport_AddModule
exec_code_module name bytecode imports the module name compiled in bytecode. bytecode can be obtained with Py.compile. Wrapper for PyImport_ExecCodeModule
Wrapper for PyImport_ExecCodeModuleEx
Wrapper for PyImport_GetMagicNumber
Wrapper for PyImport_GetModuleDict
Wrapper for PyImport_ImportFrozenModule
Wrapper for PyImport_ImportModule Note that Python memoizes imported module, so that you will get the same object if you import the same module twice. (GitHub issue #16)
let m = Py.Import.import_module "json"
and m' = Py.Import.import_module "json" in
assert (m = m')import_module_opt m imports the module m and returns the module object if the import succeeds:. in this case, it is equivalent to Some (import_module m). If the module is not found, i.e. if import_module raises a Python exception of class ModuleNotFoundError, then try_import_module returns None.
Alias for import_module_opt.
Wrapper for PyImport_ImportModuleEx
Wrapper for PyImport_ImportModuleLevel
Wrapper for PyImport_ReloadModule