def load_method(path,method,class_name = None,instance_creator = None):
    '''
        Returns an instance of the method specified.
        Args :
            path            : The path to the module contianing the method or function.
            method          : The name of the function.
            class_name      : The name of the class if the funtion is a method.
            instance_creator: The name of the method to return the class instance.
    '''
    #Load the module
    module  = load_module(path)
    if class_name :
        #If a class, Create an instance
        class_type  = getattr(module, class_name)
        if instance_creator:
            ic_rest     = instance_creator
            nxt         = module
            while ('.' in ic_rest)  :
                nxt         = getattr(nxt    , instance_creator.split('.')[0])
                ic_rest     = '.'.join(ic_rest.split('.')[1:])
            instance = getattr(module, instance_creator)()
        else :
            instance = class_type()
        return getattr(instance , method)
    else :
        return getattr(module   , method)
def load_method ( path , method , class_name = None , instance_creator = None ) : module = load_module ( path ) if class_name : class_type = getattr ( module , class_name ) if instance_creator : ic_rest = instance_creator nxt = module while ( '.' in ic_rest ) : nxt = getattr ( nxt , instance_creator . split ( '.' ) [ 0 ] ) ic_rest = '.' . join ( ic_rest . split ( '.' ) [ 1 : ] ) instance = getattr ( module , instance_creator ) ( ) else : instance = class_type ( ) return getattr ( instance , method ) else : return getattr ( module , method )
Returns an instance of the method specified.
        Args :
            path            : The path to the module contianing the method or function.
            method          : The name of the function.
            class_name      : The name of the class if the funtion is a method.
            instance_creator: The name of the method to return the class instance.