A
Andrew Berg
I'm not sure the subject's wording is the best, but I'll try to explain.
I have a main script that imports several modules and I need to be able
to call methods from a class instance inside that main script from a
module. Currently, functions can be defined to access the methods, but
such functions can only be called via commands sent to the main script
(it's an IRC bot, and commands are sent via IRC). What I want to do is
call those methods without sending commands (I want to send an IRC
message from an except clause). I'm not too sure which bits are
relevant, and it's probably a lot of code for a post, so I'll link:
Main script (DelphiBot().load() is where commands are processed):
https://github.com/sthrs/Beacon/blob/501ab1ffef83aa13613edb5985ad9a4570245a85/main.py
The module I'm working on with examples of both functions that use
commands and functions that don't:
https://github.com/sthrs/Beacon/blob/501ab1ffef83aa13613edb5985ad9a4570245a85/modules/lastfm.py
I have developer access to the repo, so modifying the main script is not
an issue (I realize there is a very good possibility this will require
changing the way the bot handles loading commands). A push in the right
direction would be greatly appreciated, as I'm quite stumped.
I have a main script that imports several modules and I need to be able
to call methods from a class instance inside that main script from a
module. Currently, functions can be defined to access the methods, but
such functions can only be called via commands sent to the main script
(it's an IRC bot, and commands are sent via IRC). What I want to do is
call those methods without sending commands (I want to send an IRC
message from an except clause). I'm not too sure which bits are
relevant, and it's probably a lot of code for a post, so I'll link:
Main script (DelphiBot().load() is where commands are processed):
https://github.com/sthrs/Beacon/blob/501ab1ffef83aa13613edb5985ad9a4570245a85/main.py
The module I'm working on with examples of both functions that use
commands and functions that don't:
https://github.com/sthrs/Beacon/blob/501ab1ffef83aa13613edb5985ad9a4570245a85/modules/lastfm.py
I have developer access to the repo, so modifying the main script is not
an issue (I realize there is a very good possibility this will require
changing the way the bot handles loading commands). A push in the right
direction would be greatly appreciated, as I'm quite stumped.