I use Python 3.6, the multiprocessing library.

There is a processing () function that writes something to the console. This function is started from main () as follows:

p = multiprocessing.Process(target=processing)

This is a long-running function.

In this case, main () in the loop is waiting for input from the user.

 while True: print("input command: ") inp = input() if inp == "processing": p = multiprocessing.Process(target=processing) p.start() if inp == "whatever": whatever() 

It turns out the situation when main () gave an invitation and waits for input, and processing writes after that.

 input command: *processing* input command: <-приглашение есть, но дальше выводится текст processing started processing finished 

The question is , is it possible from main () to somehow track the entry in the console of third-party text and repeat the invitation?

  • How to understand the "third-party text"? - E1mir
  • @KryTer_NexT text that is not displayed by the current process, or something. Well, as in the example, "processing started" and "processing finished" are not derived by the same process in which main () is executed, but by the process in which processing () is executed - MaksimB
  • Well, this is a little logical, and as I understood from your code, when you enter the word Processing you immediately start the process .. And he does his business there in parallel .. And he deduces what he says .. And as I understand you want to do so did he expect? Or output all the text after the main code? - E1mir
  • @KryTer_NexT and I do not argue that this is logical. but read the question again - I ask if it is possible for meina to somehow track the fact of writing to the console - MaksimB
  • Yes, yes, I get it :) That's how easy it will be to track it, but there is a good library for this Supervisor , if you deal with it I think it will be very good .. This library was created to monitor the child processes - E1mir

0