title: Python equivalent of TCL Create_FIleHandler
body: <p>I am looking for an equivalent of TCL Create_Filehandler API . I could not find anything useful on Google.
  The problem statement I am trying to solve can be simply put as: Make 1 C++ thread write something on a C++ thread with a python interpreter embedded and waiting on the python loop. Then the thread with python interpreter gets some notification and does some processing using the string it received on its input channel. I have the current implementation in TCL which uses Create_FileHandler which provides this behavior. Looking for something similar in python.</p>
  
  <p>Roughly , the Code looks like:</p>
  
  <pre><code>void mainpythonloop(int argc , char * argc[])
  {
      Py_Initialize();
      // Register a callback so that anything written onto the stdin is passed onto that and     called . [NEED HELP HERE]
      Py_Main(argc,argv); // Main Python loop , can either serve the input on its stdin or any other thread writing to its stdin. Should not wait on anything
      Py_Finalize();
  
  }
  </code></pre>