title: How do I write a write() method in a pkl file that I can use in my python scrpits?
body: <p>I am trying a share a boolean between different scripts. In one script, I want to edit the boolean if a certain function is called. In the other scripts, I want to use the boolean. I'm trying to use pickling, but I'm in way over my head. I have no idea what to write in my pkl file. My code kinda looks like this:  </p>
  
  <p>one.py</p>
  
  <pre><code>    import pickle
  
      boolean = False
      pickle.dumps(boolean, "filename.pkl")
  
      class Foo(object):
  
      #init method irrelevant
  
          def bar(self):
              foobar = raw_input("&gt; ")
  
              if foobar == "baz":
                  boolean = True
                  pkl_file = open("filename.pkl", 'w')
                  pickle.dumps(boolean, "filename.pkl")
              else:
                  print "Hello"
  </code></pre>
  
  <p>two.py</p>
  
  <pre><code>    import pickle
  
      class Foobar(object):
  
      #init method irrelevant
  
      def foo_bar(self):
          foobar = raw_input("&gt; ")
          boolean = pickle.loads("filename.pkl")
  
          if foobar == "foo" and boolean:
              print "Hi!"
          elif foobar == "foo":
              print "Hello there."
          else:
              print "Bye!"
  </code></pre>
  
  <p>I have another script that does something similar to two.py. My pkl file is empty.<br>
  When I try to run the main script (a completely different one from the ones with pickling), I get "AttributeError: 'str' object has no attribute 'write'</p>