Starting python thread in OBS plugin

lunameadows

New Member
I am creating a plugin that requires communication to another application so I need to make a client socket inside of the plugin. My issue is when creating a socket in a thread in obs, the whole script freezes when it is waiting for a response from the server. I haven't been able to find any examples of how this is done and am very confused on why the thread won't work in obs but works just fine outside of obs.
 
I don't have the URL, but my notes from June 2021 say 'Google finds "Scripts are executed on the OBS main thread. This means that say a network request will block OBS."' Even for Javascript on a webpage, blocking I/O is generally considered poor form because it blocks everything else.

You could look at using non-blocking sockets, or use select()

If you like your blocking recv, could you run your Python as a separate process, and use WebSocket to interface with OBS?
 
Top