As far as I understand, there are two ways to handle communication between the Python and ElectronJS:
1) Use inter-process communication. Basically, your Python app outputs to stdin and your Electron app consumes the output. Also works the other way. This is what I went with.
2) Use a Flask (or equivalent) local web server and have your app send requests to it.
I find method 2) a bit hacky and unintuitive for a desktop app. If you are planning on hosting your backend in the cloud this would be a decent solution, but I am not.
I had already done some work to turn my Python app into a standalone CLI tool using `click` [0] which made the interaction with ElectronJS very simple. I used `python-shell` [1] for the inter-process communication. I do think that I might not need this once I package my Python app into an .exe -- then Electron should be able to interact with it in some way without caring that it's built in Python.
You can take a look at my repo here, though it's still in its infancy: https://github.com/petargyurov/megadetector-gui
Nonetheless, is a great project and not so difficult to use, although not perfect, it worked perfectly for our needs.
Thanks for sharing this. I have a relatively simple Python script that I'm trying to package for a non-technical Windows user so, as someone whose experience skews toward web development, your comment caught my attention.
I just googled "electron svelte python" and found this write up:
https://medium.com/@abulka/electron-python-4e8c807bfa5e
Which references this Github repo:
https://github.com/fyears/electron-python-example
It all sounds pretty brittle. How are you managing communication between your ElectronJS frontend and Python backend? Any references you recommend?