How do I make a python script wait for sometime?
<p>I'm relatively new to python and I have written a single python script which does the following:</p>

<ol>
<li>It does some operation and writes the details to a text file(say a.txt)<br/></li>
<li>Once the txt file(a.file) is written, the same file is read to do some operations.</li>
</ol>

<p>The problem I face is once the file(a.txt) is written and same is read, the contents are not read.</p>

<p>I use <code>time.sleep()</code> after the txt file(a.txt) is written and then proceeded with reading the same.</p>

<p>But whats happening is the script is stopping it's execution for the time period mentioned in the sleep method and the txt file is not read.</p>

<p>I need a scenario where the same script must write to a text file and read instantly.</p>

<p>Could someone help me please? Thanks in advance.</p>
