title: Python : How to save object state and reuse it
body: <p>I want to save object state and reuse it after some time. 
  I got some example on How to save object (Pickle module), I was not able to find how to resume class/method from the save state and proceed further.</p>
  
  <p>Like game, we can save the game and latter we can continue, I know in game we save all the data and game read the data and build the game.  </p>
  
  <p>I want to save complete object and when I restore it it start working from saved state.</p>
  
  <p>For example </p>
  
  <pre><code>class Test(objet):
     def doSomeWork(self):
       index = 0
       while index &lt; 99999:
          print index 
          index  += 1
          if saveCondition:
            # suppose when condition become True index value is 100
            saveCondition = None
            saveTheObjectToFile() # this might be saved in file
  restoreClassObject = getSavedObject() # get object from file
  # Now this should start printing from 100
  # I want to resume the object state when it was saved.
  </code></pre>