Waiting for an operator thread or stack to complete. stacking multiple operators

Asking this here as well…

I’m trying to get an operator to call another operator and wait for the operator’s response before proceeding.

Doing so with sub-process doesn’t work - apparently it needs to be fed “INVOKE_REGION_WIN” and that only works when calling it directly.

Doing so natively doesn’t work. can’t even loop like you would do for any File/IO transaction of a dialog (str = dialog(), if str!="" > move on else wait )

what’s the proper way to do this for the Blender API?

NOTE: This is not a common “dialog” issue, we need to wait for the additional operator to completely finish and return {‘FINISHED’}

same as it would if you stack 2 functions within one another …

Edit. Adding in a code sample that doesn’t work but it’s closer then I got out of anything else.

def modal(self, context, event):
    if self.fileimport == {'FINISHED'}:
        bpy.ops.object.select_all(action='DESELECT')
        print("finished")
        return {'FINISHED'}
    else:
        print(self.fileimport,context,event)
        return {'PASS_THROUGH'}

def invoke(self, context, event):
    self.fileimport = bpy.ops.import_scene.fbx("INVOKE_REGION_WIN")
    context.window_manager.modal_handler_add(self)
    return {'RUNNING_MODAL'}

The problem with that is that the result copyed to file import is really only passed once at the start. Getting the modal function update it means locking up blender in a loop…

giving my self somewhat of an answer. this obviates the problem with a work-around but it’s hardly proper.

sceneobjects = 0
	currentobjects = 0
	
	def modal(self, context, event):
		if self.currentobjects > self.sceneobjects:
			bpy.ops.object.select_all(action='DESELECT')
			print("finished")
			return {'FINISHED'}
		else:
			self.currentobjects = len(bpy.data.objects)
			print(context.window_manager)
			return {'PASS_THROUGH'}
	
	def invoke(self, context, event):
		#save current number of objects on scene
		self.sceneobjects = len(bpy.data.objects)
		#start the import
		bpy.ops.import_scene.fbx("INVOKE_REGION_WIN")
		context.window_manager.modal_handler_add(self)
		return {'RUNNING_MODAL'}