[Twisted-Python] how to access irc.IRCClient.* from other classes

Jonathan Lange jml at mumak.net
Fri Sep 8 00:49:42 EDT 2006

On 9/5/06, Nick Rehm <speedy at nitroforce.eu> wrote:
> Hello,
> iam playing around with twisted.words.irc and come upon this what i dont
> understand right now

You have to pass a reference to 'mainirc' to either 'somestuff' or 'test'. e.g.

class somestuff:
    def __init__(self, ircClient):
        self.ircClient = ircClient
    def test(self):

class mainirc(irc.IRCClient):
    def connectionMade(self):
        self.bot = somestuff(self)

Constructing a new instance of 'mainirc' won't work, because the new
instance won't be associated with a connection.

hope this helps,

More information about the Twisted-Python mailing list