diff --git a/modules/python/src2/cv2.cpp b/modules/python/src2/cv2.cpp index 59a4c67bc5..ff53d733c4 100644 --- a/modules/python/src2/cv2.cpp +++ b/modules/python/src2/cv2.cpp @@ -1235,7 +1235,9 @@ static void init_submodule(PyObject * root, const char * name, PyMethodDef * met submod = PyImport_AddModule(full_name.c_str()); PyDict_SetItemString(d, short_name.c_str(), submod); } - root = submod; + + if (short_name != "") + root = submod; } // populate module's dict