In the context of a complex application, I need to import user-supplied \'scripts\'. Ideally, a script would have
def init():
blah
def execute():
mo
A solution to 1 to 3, ( not the yadda part ) is to hand out "generic_class.py" with all the methods that you need. So,
class Generic(object):
def __init__(self):
return
def execute(self):
return
# etc
You can then check for the existence of "generic" in what you've imported. If it doesn't exist you can ignore it and if it does then you know exactly what's there. Anything extra will never be called unless it's called from within one of your pre-defined methods.