title: Keeping Python Interpreter Alive Only During the Life of an Object Instance
body: <p>I have defined a class for using python interpreter as follows:</p>
  
  <pre><code>class pythonInt
  {
  public:
      pythonInt(const char* fname) {
          py::initialize_interpreter();
          m_Module = py::module::import(fname);
      }
      ~pythonInt() {
          py::finalize_interpreter();
      }
      py::module m_Module;
      // ... other class members and functions that uses m_Module
  };
  
  int main()
  {
      pythonInt *p1 = new pythonInt("pybind_test1");
      delete(p1); 
  
      pythonInt *p2 = new pythonInt("pybind_test1");
      delete(p2); 
  
      return 0;
  }
  </code></pre>
  
  <p>As soon as the class instance is being destructed I get <code>Access violation reading location</code> error when it reaches to deleting the instance <code>_Py_Dealloc(op)</code>. How can I finalize the interpreter such that I can successfully delete the previously created class instance <code>p1</code> and safely create a new class instance <code>p2</code>?</p>