You can use an external library written in C/C++ in Python using the ctypes
module. Beware though that C++ mangles function names, and ctypes can only use functions that are declared extern "C"
! (see e.g. this question)
To call a Python script from C++ you have two options:
- Start a new Python process with the script name as an argument. On windows you can e.g. use CreateProcess for this.
- Embed Python in the C++ app as Janne Karila mentioned.
Note that these things don't have much to do with communication between programs.
A library doesn't really communicate because it's not a process. It just supplies functions and data for a process to use.
And you can start a process from another process without communication whatsoever between them.
To communicate between processes you use interprocess communication. The different methods of doing that on Windows are listed here.