Reloading a pybind11 module from Jupyter notebook #4225
Unanswered
samuelpmish
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I've got a pybind11/nanobind project where I'm compiling C++ sources, and using the python bindings from a Jupyter notebook. After doing
import my_cpp_bindings
in the notebook, if I make a change to the C++ sources and recompile, the Jupyter kernel doesn't seem to detect that the binarymy_cpp_bindings.cpython-310-darwin.so
file has changed, so the new behavior doesn't take effect. The new binary is used if I completely restart the Jupyter kernel, but I was wondering if anyone has run into this before and has a cleaner solution.I've tried doing
importlib.reload(my_cpp_bindings)
and using Jupyter's%autoreload
tools, but neither of those approaches seems to work for these.so
files-- the Jupyter kernel still has the "old" behavior (but they work great for reloading regular python files).Beta Was this translation helpful? Give feedback.
All reactions