Let's say I'm building a tabbed editor in Python and I want to associate it with certain file type so that double clicking files of this type opens the file in this editor.
It's easy to open separate editor instance for each file, but what's the recommended cross-platform way for opening the file in new tab of existing editor instance if it's available?
I'm considering using sockets so that first time the editor is executed it starts listening a port and publishes the port number in a known file. Next time the editor is run, it notices the port number, lets the first instance know the file to open and exits. I don't like this plan very much, because (I suppose) in Windows the users get confusing warning when the first socket is created.
Can you recommend a more straitforward way to achieve single program instance in Python?