diff --git a/modules/gui/src/python_shell/python_interpreter.cc b/modules/gui/src/python_shell/python_interpreter.cc
index 93c9af99b92f7b246aa41acbe1c7d63402faf1cd..4c2afae419b13f7e3fa264e1782ac66a7e797638 100644
--- a/modules/gui/src/python_shell/python_interpreter.cc
+++ b/modules/gui/src/python_shell/python_interpreter.cc
@@ -66,6 +66,9 @@ PythonInterpreter::~PythonInterpreter()
 
 PythonInterpreter& PythonInterpreter::Instance()
 {
+  if(!Py_IsInitialized()){
+    Py_InitializeEx(1);
+  }
   static PythonInterpreter instance;
   return instance;
 }
diff --git a/modules/gui/src/python_shell/python_interpreter_worker.cc b/modules/gui/src/python_shell/python_interpreter_worker.cc
index c65a6d002815d9b894cc3b2400334ccc711807e3..287660144276bf842a1bbf01bd2d4d8034162190 100644
--- a/modules/gui/src/python_shell/python_interpreter_worker.cc
+++ b/modules/gui/src/python_shell/python_interpreter_worker.cc
@@ -20,6 +20,7 @@
 
 #include "python_interpreter_worker.hh"
 #include "python_interpreter.hh"
+#include <iostream>
 
 namespace ost { namespace gui {
 
@@ -55,7 +56,6 @@ PythonInterpreterWorker::PythonInterpreterWorker():
   current_id_(),
   awake_(false)
 {
-  Py_InitializeEx(1);
   parse_expr_cmd_=bp::import("parser").attr("expr");
   main_namespace_ = bp::extract<bp::dict>(bp::import("__main__").attr("__dict__"));
   repr_=bp::import("__main__").attr("__builtins__").attr("repr");