on-internet
← Community

PyO3 unable to find/call Python function from within a Rust application

Stack Overflow ·

I have the beginning of a GUI application written in Rust. I'm using the Py03 crate to run a python function inside my Rust app. I have my python function (test_func) inside a file "test_funcs.py" and this file is located in the same directory as my Rust binary. I also have a copy of this file in the root directory too. The problem is, whilst Py0 is able to find my .py file, it can't seem to find the function I'm trying to call. Here is the key bit of code: MyAppMessage::SecondButton => { Python::with_gil(|py| { let my_module = PyModule::new(py, "test_funcs").expect("Could not load Python modu

Comments

Sign in or sign up to comment and upvote.

No comments yet.