Skip to content

Need some help with how to load a python function once and use it over and over instead of loading it every time #2755

Discussion options

You must be logged in to vote

You can convert sum_func to a Py<PyAny> (just using into()). That object can live outside the with_gil block, you can store it in a Rust struct or in a lazy_static/once_cell global.

As for using third party libraries, just do PyModule::import(py, "pandas") and go on from there.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@mejrs
Comment options

@birkenfeld
Comment options

@vamshiaruru-virgodesigns
Comment options

@davidhewitt
Comment options

@vamshiaruru-virgodesigns
Comment options

Answer selected by vamshiaruru-virgodesigns
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants