Calling functions in main script from a module
James Bursa
james at bursa.freeuk.com
Tue Sep 21 13:13:39 EDT 1999
Is it possible to call a function in the main script (the one passed on the
Python command line) from a module function?
I've attempted to use something like __main__.function(), but this doesn't
work. The reason I want to avoid passing a function pointer to the module
function is because I'd like to generate the function name dynamically
(depending on a gui event) and use eval(), like this
try:
eval('event_message_' + hex(message_number))
except NameError:
pass
I could then write appropriate functions for events I wanted to handle in
the main script.
Is this possible?
Thanks,
James
--
James Bursa james at bursa.freeuk.com
Cambridge, UK http://home.freeuk.net/bursa/james/
More information about the Python-list
mailing list