class Foo(object):

    def __init__(self, bar):
        self.bar = bar
if os.path.exists('foo.pickle'):
    with open('foo.pickle') as f:
        foo = pickle.load(f)
else:
    foo = Foo(42)
print(foo.bar)
foo.bar = input('new bar: ')
Python: how to share an object instance across multiple invocations of a script