Replies: 2 comments
-
This feature is outside of the scope of this project for reasons of maintainability and performance, see this section of the documentation. You will need to maintain a forked version of nanobind yourself if you wish to add such functionality. |
Beta Was this translation helpful? Give feedback.
-
@niyue if you already have an embedded interpreter and have some sort of global object you can add a getter to the object that retrieves a nanobind module you create. @wjakob no fork/modifications to nanobind! :) After finding Python and nanobind in CMakelists.txt you can simply call: Then once everything is building you just need to make a NB_MODULE(my_module, m) {
m.doc() = "My embedded module!!!";
}
which you can pass directly to a getter or cache it's returned value so it doesn't get recreated each time you get it. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
pybind11 supports embedding Python interpreter into a C++ program (https://pybind11.readthedocs.io/en/stable/advanced/embedding.html), and I briefly read nanobind's documentation, and it seems not mentioned in the doc. I wonder if this is supported by nanobind, and if it is not supported, is it part of the roadmap for the future? Thanks.
Beta Was this translation helpful? Give feedback.
All reactions