I am new in using os.system (in Python 3) and am trying to execute a program that I would normally run in a Linux terminal. I need to iterate a few times and am using something like the following loop:
for item in item_list:
    os.system("gnome-terminal -- program_execute "+item) 
The problem is that this loop simutaneously opens n terminal windows (the length of my item_list is n) and executes all of them at the same time. My question is:
How could I run the loop len(item_list) times with the next run starting only after the current one finishes?
I can't use sleep() because the running time varies from item to item and I would like to optimize the process.
EDIT: I've tried using .communicate() and .wait() without success. I would like os.system (or os.subprocess) to understand that the gnome-terminal is still running, only passing by the next element in the loop after gnome-terminal from previous loop has closed.