Pyo3's documentation about "Rust calling Python" is less abundant than about "Extending Python with Rust". My goal is to have a state in Python (class
) with repeated calls to Python script methods
and functions
to update the Python state. My prime problem is coordinating lifetimes between GIL, lock and Python references and objects...
I have the following questions:
- The script module has to be loaded (and compiled to bytecode) only once. How can this be done when it can not outlive the GIL's lifetime?
- How to call the module's
methods
andfunctions
by name passing the Python state to be updated? - Which are good example projects (using
pyo3
) for studying "Rust calling Python" intricacies?
Thanks.