how to use PyModule multiply times in different parts of code #3824
-
I am creating a Py Module from the code (PyModule::from_code) and it takes a very long time, while the module does not change in any way. Can I somehow create a module and return it for further use in the code? I use py.run, where only user_code and locals change. I'm new in rust, so please understand :) |
Beta Was this translation helpful? Give feedback.
Answered by
adamreichold
Feb 14, 2024
Replies: 1 comment 7 replies
-
Without seeing the specifics of your program, I suggest you can create the module once and pass it around your program as a |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try mapping the value only, e.g.
PyModule::from_code(py, &indicators_file, "indicators", "indicators").map(|module| module.into())