Once I needed to implement a simple python plugin engine in a C/C++ software, I've been successfully using the official guide [1].

[1] https://docs.python.org/3/extending/embedding.html