Function to get a message from raw IRC in parser.py: def getmsg(self,input): m = input.strip(":").split(":") global msg msg = m[1] Code to print out the result in dinbot.py: global messages messages = self.parser.getmsg(data) print messages Code to check for hai and respond: if messages == "hai": self.parser.sayhai(data)