MichaelvdNet
MichaelvdNet

Reputation: 1074

Send data from module to script

im creating an IRCbot module for people who are not that advanced to python.

But now im accurring a problem. the module has this:

while 1:
    text=irc.recv(4096)

but is there a way to send "text" back to the script so i can use module.find or something

Thanks!

Upvotes: 0

Views: 79

Answers (1)

Hans Then
Hans Then

Reputation: 11322

If I understand your problem correctly . . .

You users will probably need to define a callback. Your module will look like this:

user_callback = None

def register_callback(callback):
    global user_callback
    user_callback = callback

def main():
    while 1:
        text=irc.recv(4096)
        user_callback(text)

Upvotes: 1

Related Questions