How to solve Nano collisions

I there.

I have two apps that need to use the same blinkstick on the same unix server. Because these are a socket server and client I’m very much in control of when the calls for the nano are made, however I’m running into usb collisions, at least I think I’m getting usb collisions, the error messages aren’t very clear.

When data is sent and received the two apps loop the sticks, blink, then turn off the sticks. Because the data is sent/received in a very particular manner there shouldn’t be any conflict. But, there obviously is.

So, how do I avoid collisions from different apps? I’m not at all happy to use a ret/except and just ignore the error, I need the blinks.

I’ve tried sleeps but I still get problems unless the down time is high, and I really don’t want that either.

Is there a command to check if the stick is busy? Or any other ideas?

Thanks.

Would recommend building a service that for example listens on http for requests on a port and manages animations from within one application. Then your apps can call the service and trigger animations. LMK if you need any help with this.