So I am writing a program and I want to run it in different computers but there are certain variables that should be updated in both computers according to the running programs input. So how can I make those 2 programs communicate with each other?
You're talking at quite a low level. Say more at a high level about what this program is and what it's supposed to do. That will help people suggest appropriate solutions.
One thing you do need to be aware of though, is that the network connecting the machines can (and will!) fail and so you'll need to deal with this problem of eventual consistency.
You could perhaps have a look into the
RPyC module which does distributed computing.