So in visual studio c++ application, I have a bit where I need to call python script
Py_Initialize();
PyObject *obj = Py_BuildValue("s", "..\\..\\SDK\\scripts\\JsonToExcel.py");
FILE *file = _Py_fopen_obj(obj, "r+");
if (file != NULL) {
`PyRun_SimpleFile(file, "..\\..\\SDK\\scripts\\`[`JsonToExcel.py`](https://JsonToExcel.py)`");`
}
Py_Finalize();
In the JsonToExcel.py I import pandas. So when I run the application and call this program it executes perfectly, but when I call the program once again I get an error for line "import pandas", saying
C:\A\31\s\Objects\structseq.c:401: bad argument to internal function
This error does not occur if I close the application and run it again
I saw a similar problem in this stack overflow question
Python C API error restarting interpreter
But there wasn't any solution.
Any ways to resolve this?