See this topic for details about how to run Python code from C++:
For more complex Python calls, search for “pythonmanager” in Slicer source code.