I realized that when I write into a file using python it wait until the end of my Python file to execute it:
outputFile = open(\"./outputFile.txt\",\"a\") ou
Force it with the flush() function, add
flush()
outputFile.flush()
at the end of your code.