title: How to communicate with Python back-end from Angular component when using Electron application?
body: <p>I am trying to create a desktop application using Electron.
  My requirement is to use Angular for front-end and python for back-end (that should communicate with SQLite database).</p>
  
  <p>This is what I have ready:</p>
  
  <ol>
  <li>I have the front-end web application created/designed by Angular 7 and Material</li>
  <li>I also have 10 pure python files (without any framework) that should do some back-end logic whenever buttons are clicked from the web application. </li>
  <li>Electron environment is ready and main.js is pointing to Angular index.html file.</li>
  <li>Python files are in a separate folder not connected to anything yet.</li>
  </ol>
  
  <p>When I fire up the Electron, the app starts and I can see the Angular web interface. <strong>All I have left to do is to send the requests when the button is clicked to the backend (python files).</strong></p>
  
  <hr>
  
  <p><strong><em>What I know and have tried so far:</em></strong></p>
  
  <ul>
  <li>Add ngx-electron module to my Angular component <code>import { ElectronService } from "ngx-electron"</code></li>
  <li>I use <code>ipcRenderer.send('aaa', data)</code> to send data and <code>ipcRenderer.on('bbb', () =&gt; {})</code> to get the response from a MAIN process</li>
  <li><p>In the MAIN process (main.js), </p>
  
  <p><code>ipcMain.on('aaa', (e, filename) =&gt; { 
      // exec(pythonfile params);
      e.sender('bbb', response);
  })</code></p></li>
  </ul>
  
  <hr>
  
  <p><strong>Questions:</strong></p>
  
  <p>Is this the right way or there is a cleaner solution to send and receive data between Angular and python? </p>
  
  <p>I feel like when you have lots of requests those listeners will become messy, not sure. I have always used HTTP requests that are cleaner but never used inter-process communication ... </p>