I\'d like to prevent multiple instances of the same long-running python command-line script from running at the same time, and I\'d like the new instance to be able to send data
Sounds like your best bet is sticking with a pid file but have it not only contain the process Id - have it also include the port number that the prior instance is listening on. So when starting up check for the pid file and if present see if a process with that Id is running - if so send your data to it and quit otherwise overwrite the pid file with the current process's info.