Hello developers !
I’d like to execute a function after a button operator has been executed.
Hereafter, once a file has been opened, the function read_now should be called.
...
class FileButton ( bpy.types.Operator ) :
bl_idname = "one.button"
bl_label = "My_File"
def execute ( self, context ) :
bpy.ops.text.open ( 'INVOKE_DEFAULT' )
return { 'FINISHED' }
# def read_now ( self ) :
print ( "read something" )
# return self.read_now() does not work, in case I had put read_now in this class
# because return expects a string
def read_now () :
print ( "read something" )
I thought I could put def read_now () in the class and return self.read_now in the ‘execute’ function but doesn’t work.
Other idea, putting def read_now () out and calling it on the return condition of the ‘execute’ function.
But how to do that ? Can ‘FINISHED’ be tested somehow ?
Thanks for any information !
SF