title: Can users pickle and then reload all variables in one shot? Idea for an AutoSave function
body: <p>I want to save all the global variables into a pickle file, and then reload the pickle file and have it retrieve all the pickled values and put them back into their original variables.  This will be the basis for auto save function of a databasing program that I'm writing, so that if you want to end off that logging session, the script will auto save the entire environment variables, so that you can easily reload it later and continue with everything being as it was before you saved.</p>
  
  <p>I can't figure out though how to do this.  This code below works, but if you look at the second print of variables once it is done, the globals (ab&amp;c) are still zeroed out, instead of being refilled from the pickle.  </p>
  
  <p>Is it even possible to reassign all the globals in one shot?  What am I missing?  </p>
  
  <pre><code>import pickle
  
  global a,b,c
  
  a = 1
  b = 2
  c = 3
  
  print (globals())
  
  AutoPickleFile = open('z:\\Pickle.txt','wb')
  pickle.dump(globals, AutoPickleFile)
  AutoPickleFile.close()
  
  a = 0
  b = 0
  c = 0
  
  AutoPickleFile = open('z:\\Pickle.txt','rb')
  globals = pickle.load(AutoPickleFile)
  AutoPickleFile.close()
  
  print (globals())
  </code></pre>