Page MenuHome

Cannot combine invoke_props_dialog with a modal execution
Closed, ResolvedPublic


Blender Version

Using invoke_props_dialog or another function which requires RUNNING_MODAL in invoke (like fileselect_add) is not possible with a modal excution (ie using modal_handler_add and a modal() function).

The folowing code crash Blender.

import bpy
from bpy.props import IntProperty

class TEST(bpy.types.Operator):

	bl_idname = "test.modal"
	bl_label = "test invoke props + modal"

	nb = IntProperty(name="int prop")

	def invoke(self, context, event):
		return context.window_manager.invoke_props_dialog(self)
	def execute(self, context):
		return {'RUNNING_MODAL'}

	def modal(self, context, event):

		if event.type in {'ESC'}:
			return {'CANCELLED'}

		return {'RUNNING_MODAL'}

def register():

def unregister():

if __name__ == "__main__":

Event Timeline

domlysz (domlysz) raised the priority of this task from to Needs Triage by Developer.
domlysz (domlysz) updated the task description. (Show Details)
domlysz (domlysz) added a project: Python.
domlysz (domlysz) set Type to Bug.

Let’s see what @Campbell Barton (campbellbarton) says here, but would not expect this to work, context.window_manager.invoke_props_dialog(self) is already running modal, so that would be trying to fire two modal sessions one after the other, from the same operator…

Bastien Montagne (mont29) lowered the priority of this task from Needs Triage by Developer to Normal.