0

I’m using the multiprocessing module In python to run 2 different codes at the same time, however I have a rly small problem, in the code I’m writing the two programs must share a variable if it changes then the first program does this and if it stays the same the second program does that, how can I make a variable shared between these two programs?

Hamza Eyad
  • 43
  • 4
  • List your code. – Carlos Bazilio Aug 05 '20 at 20:52
  • 2
    Does this answer your question? [How to share variables across scripts in python?](https://stackoverflow.com/questions/1829116/how-to-share-variables-across-scripts-in-python) – FishingCode Aug 05 '20 at 20:58
  • 1
    You'll have better luck thinking not in terms of sharing but in terms of information-passing. One process can pass information to another (via a queue, pipe, one the other mechanisms offered by `multiprocessing`, or even via a database or file system). To get started, see https://docs.python.org/3.8/library/multiprocessing.html#exchanging-objects-between-processes – FMc Aug 05 '20 at 21:11
  • FMc Thanks a lot I’ll check it out – Hamza Eyad Aug 05 '20 at 21:51

0 Answers0