Modal Operator -- "invoke" not being called while invoked through script A simple Node:
import bpy

class TestNode(bpy.types.Node):
    '''ww Test Node'''
    bl_idname = 'ww_TestNode'
    bl_label = 'TestNode'
    bl_icon = 'ARROW_LEFTRIGHT'
    bl_width_min = 400
    bl_width_max = 5000

    @classmethod
    def poll(cls, ntree):
        return ntree.bl_idname == 'ww_NTTest'

    def update_func(self,context):
        pass

    def init(self, context):
        bpy.ops.ww.test_modal_operator()
        pass

    def copy(self, node):
        print(&quot;copied node&quot;, node)

    def free(self):
        print(&quot;Node removed&quot;, self)

    def draw_buttons(self, context, layout):
        row = layout.row()
        row.operator('ww.test_modal_operator',text='Test Button')

    def draw_buttons_ext(self, context, layout):
        pass

A simple modal Operator
class TestModalOperator(bpy.types.Operator):
&quot;&quot;&quot; This operator Tests it's invoke method&quot;&quot;&quot;
bl_idname = &quot;ww.test_modal_operator&quot;
bl_label = &quot;Test Modal Operator&quot;

def modal(self, context, event):
    if event.type ==&quot;ESC&quot;:
        return self.cancel(context)

    if event.type == 'TIMER':
        pass
    
    return {'PASS_THROUGH'}

def execute(self, context):
    print('execute')
    self._timer = context.window_manager.event_timer_add(0.001, window=context.window)
    context.window_manager.modal_handler_add(self)
    return {'RUNNING_MODAL'}

def invoke(self, context, event):
    print('invoke')
    return {'RUNNING_MODAL'}     

def cancel(self, context):
    print('cancel')
    context.window_manager.event_timer_remove(self._timer)
    return {'CANCELLED'}

By inserting the node into the tree it starts a modal operator. Using it's init method.
A button to start an other instance of the operator is provided as well.
The instantiation by the init method does not call the invoke method of the operator
but the call goes to the execute method, the button goes to the invoke method.
Is this intentionally?  If so why?
WKR
Martin
It is intentional!
This behavior is controlled with
bpy.ops.some_operator('INVOKE_DEFAULT')
or
bpy.ops.some_operator('EXECUTE_DEFAULT')
and it's assumed that a script calls execute by default
and a button calls invoke.
it is in the doc's but somewhat obfuscated.