IIRC the rules are different for subprocesses of the caller of SetForegroundWindow
ie. If you launch a subprocess from sublime, are focused there, and a set_timeout calls you back to sublime it should work ...
[pre=#0C1021]import sublime, webbrowser
from functools import partial
from ctypes import windll
>>> from tester import do
sublime.set_timeout (partial( windll.user32.SetForegroundWindow,
sublime.active_window().hwnd()), 500 )
Bisect from 500 downwards towards and you'll converge on a point where it's just too slow.