Python is very communicative. On the one hand, it is very easy to call C++ functionality from Python (extend), and on the other hand, Python can be used directly from a C++ runtime (embed). Extending allows you to offload performance-critical parts of your program to C++ or to overcome the GIL (global interpreter lock) in Python. Thanks to embedding a Python interpreter in your C++ application, the C++ application has a scripting interface.
I show how you can include existing shared libraries and extend Python with your own shared libraries thanks to the ctypes module. Furthermore, I introduce the frameworks SWIG and pybind11 to almost automate this process.
Finally, I go into the mirror image process: How to embed Python in a C++ application.