Making a C++ module part of a Python package

Viewed 1017

I have the following directory layout

awesome_package
\- module1.py
\- build
   \- module2.so

I currently import module1 as

import awesome_package.module1

and module2 as

import sys
sys.path.append('path/to/awesome_package/build')
import module2

but I would like to be able to use the former syntax.

module2 is created by pybind11 in a fashion like:

PYBIND11_MODULE(module2, module2) {
    module2.doc() = "C++ module wrapped for Python";
    module2.def("some_cpp_function", some_cpp_function) 
}
1 Answers
Related