B
B
become_iron2015-03-06 17:14:57
Python
become_iron, 2015-03-06 17:14:57

How to share data between scripts (Python)?

Special case: there are two scripts containing cycles. How can I make the loop iteration in the first script happen only after the loop in the second one, and then vice versa?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Velichko, 2015-03-06
@become_iron

What you are looking for is called IPC . Specifically for Python, see here .
In order to ensure the interaction of several independent scripts, you can use the following approach: open a pipe in both processes. The first script performed an action - it wrote to the channel and starts blocking reading from the channel. The second script received a message from the channel - performed an action, made a record in the channel, unblocking the first script. He himself again hung on reading from the channel. Etc. Instead of a pipe, you can use socket, shared memory, etc. As correctly noted by comrade bobrovskyserg, in the general case, IPC is about the interaction of heterogeneous processes, they do not have to be all (or at least one) written in Python.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question