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.Module.compile (you may also consider Py.Import.exec_code_module_from_string. Wrapper for PyImport_ExecCodeModule
Wrapper for PyImport_ExecCodeModuleEx
val exec_code_module_from_string :
name:string ->
?filename:string ->
?dont_inherit:bool ->
?optimize:optimize ->
string ->
Object.texec_code_module ~name ?filename ?dont_inherit ?optimize source_code compiles source_code and imports the resulting bytecode as module name. filename is equal to name by default and is used in error messages. dont_inherit and optimize are passed to Py.Module.compile for compiling source_code.
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