def __init__(self, *args):
    print('args:', args)

def blabla(self):
    self.x = 123
print(self.some_param)

def getme(self):
    print(self.x)
How to pickle an instance of a class which is written inside a function in python?