How to save state of execution in python
<p>i have an assignment in python for which some complicated idea is needed.
please help me . . . . . 
suppose initially i have a file to load into an array 'arr01' then i have two python source code file say 'a.py' and 'b.py'.</p>

<p>a.py takes some element from that loaded array 'arr01' and modifies the array 'arr01' and send an argument to b.py.</p>

<p>b.py will generate a string 'str' and whenever nedded further data it wil call a.py to send more elements. </p>

<p>the problem here is that the array arr01 should to loaded and the execution state of a.py and b.py must be saved because b.py will call a.py whenever element is needed and a.py must have to keep the track of elements that it has sent to b.py from arr01</p>

<p>how can i use both a.py and b.py simutaniously?</p>

<p>The following approach should get you there:</p>

<ul>
<li>define in <code>a.py</code> a class with a method that provides data from arr01 and tracks what has been sent</li>
<li><code>import a</code> in <code>b.py</code></li>
<li>call the class method from <code>a</code> in your code in <code>b</code></li>
</ul>

python python-2.7 python-3.x