Base class in a submodule, derived class in some other submodule. #538
-
I have a module To make things more complicated, each module is defined in a different cpp translation unit: NB_MODULE(paracadis, m) {
m.doc() = "ParaCADis python interface.";
init_naming_scheme(m);
init_geometric_primitives(m);
init_document_tree(m);
} Each method called above creates a submodule. Many classes in Speaking in more abstract terms, in nb::class_<BaseClass>(S, "BaseClass"); In // Does not seem to work.
nb::class_<DerivedClass, BaseClass>(T, "DerivedClass");
// Maybe, something like this... but where do I get `b` from?
nb::class_<DerivedClass>(T, "DerivedClass", b); What would be the correct way to setup bindings for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I think that should be supported. You can give a Python object to |
Beta Was this translation helpful? Give feedback.
I think that should be supported. You can give a Python object to
nb::class_
to use as base, and you can usenb::module_::import_("..").attr("..")
to fetch that object. Please refer to the documentation, this case is explained there somewhere.