Replies: 2 comments 6 replies
-
One thing that works is calling So unless I'm confused about this,
|
Beta Was this translation helpful? Give feedback.
-
I have a related issue but I'd like to use pyclass defined in "inner" crate to be accessible to rust code from outer crate. Linker appears to dislike this setup... It appears the only way to access rust pyclasses from rust "outer" crate is to link everything in one go, and thus piling everything into one crate (which is not best for compile times but gets the job done). |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
This seems like a reasonably common case: a Rust app includes scripts written in Python that in turn rely on modules provided by the app and also written in Rust.
I would expect this to be mentioned in Calling Python from Rust.
This turns out to be a rather hard topic to search for because search engines see queries as a salad of "Python, Rust, module", and basically every PyO3 page fits.
There is
PyModule::from_code
that creates and loads a module, but there doesn't seem to be a way to load a module created withPyModule::new
. I'm confused whether thepymodule
macro is at all needed for modules that are not being compiled as a separate dynamically linked library.Help?
Beta Was this translation helpful? Give feedback.
All reactions