I have some objects that spawn a subprocess to check, update, and propagate their state occasionally. These subprocesses use some of the same functions that I use in the main process.
The problem here is that the subprocesses aren't working on the same object in memory. These functions are, in some cases, complex and they alter the object state. There are a lot of interdependencies, as well.
So, I've read up on Manager, Namespaces, Array, Values, Pipes, Queues, etc to manage all this, but it seems like overkill to transform all my object attributes to Values, for instance, and then have every function need an injection if its a subprocess and a default value if not telling the function to use self attributes instead of the injected variables. Either that or have duplicate functions that do the same thing but with one just for subprocesses and the other for the main process.
It seems like I'm missing something easy. This is a lot of overhead for just wanting a class to check itself in a subprocess. Is there a way to just have the subprocess work on the same object? I've tried passing it in with args and that doesn't work.
Note -- I'm using subprocesses because some of the checks do shell commands that take time and they hang the gui. I tried with threading and it still hangs, so multiprocessing seemed to be the answer.
Any help is appreciated.