Refactor CMakeLists.txt: extract InvokePython module/function and obviate the 2 similar cmake modules.