How to understand drag and drop events?

When I try to drag and drop a file into Blender I see this line on console window:
drop file D:\downloads\model.obj

When I search for this string (where is printed exactly) is only in two places, the most possible is here (rather the other playanim).
https://github.com/blender/blender/blob/594f47ecd2d5367ca936cf6fc6ec8168c2b360d0/source/blender/windowmanager/intern/wm_window.c#L1423

How the event is handled is only just with a simple println, other than that, what is the best way to interpret this in Python? Such as for example creating a modal operator that will scan the output stream? (Very risky I would say).

So the question is how to interpret this message, so I can create an operator to do the import and stuff?

2 Likes

Have you ever found a solution to this problem? It would be great to call a python API every time a file is dropped in the viewport! I’ve also noticed that print in the console and it brought me here…