MCPcopy Create free account
hub / github.com/dgrunwald/rust-cpython / import

Method import

src/objects/module.rs:43–46  ·  view source on GitHub ↗

Import the Python module with the specified name.

(py: Python, name: &str)

Source from the content-addressed store, hash-verified

41
42 /// Import the Python module with the specified name.
43 pub fn import(py: Python, name: &str) -> PyResult<PyModule> {
44 let name = CString::new(name).unwrap();
45 unsafe { err::result_cast_from_owned_ptr(py, ffi::PyImport_ImportModule(name.as_ptr())) }
46 }
47
48 /// Return the dictionary object that implements module's namespace;
49 /// this object is the same as the `__dict__` attribute of the module object.

Callers

nothing calls this directly

Calls 2

as_ptrMethod · 0.45

Tested by

no test coverage detected