diff --git a/CMake/ctkMacroWrapPythonQtModuleInit.cpp.in b/CMake/ctkMacroWrapPythonQtModuleInit.cpp.in index c74b6665cd..8f2bc84cb1 100644 --- a/CMake/ctkMacroWrapPythonQtModuleInit.cpp.in +++ b/CMake/ctkMacroWrapPythonQtModuleInit.cpp.in @@ -3,6 +3,8 @@ #include #include +#include + //----------------------------------------------------------------------------- static PyMethodDef Py@TARGET_CONFIG@PythonQt_ClassMethods[] = { {NULL, NULL, 0, NULL}}; @@ -52,6 +54,12 @@ void copyAttributes(PyObject* orig_module, PyObject* dest_module) //----------------------------------------------------------------------------- void init@TARGET_CONFIG@PythonQt() { + + if (!QCoreApplication::instance()) + { + PythonQt::init(PythonQt::PythonAlreadyInitialized); + } + static const char modulename[] = "@TARGET_CONFIG@PythonQt"; PyObject *m;