I have a class which have several functions in it. In file1, I have created an instance of that class.
class requestHandler():
def __init__(self):
......
def processRequest(self,command):
......
if __name__ == "__main__" :
currentHandler = requestHandler()
Now, I want to access this 'currentHandler' instance from another file. I have tried several ways, but have been failed. If I try like this:
import file1
class adapter:
def __init__(self):
command = "move"
.......
def processRequest(self):
d = file1.requestHandler()
d.processRequest(command)
It creates a new instance of 'requestHandler' class. But I do not want that.
Can someone please help me in this regard? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire