This works, if it's in the current desktop:
set kmInst to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
set _windowName to getvariable "Local_windowName" instance kmInst
get id of first window whose name is _windowName
end tell
Then I wrote a macro that loops through all my desktops, to see if the window is on any of them. If it is, the macro brings the window to the front. Otherwise it returns to the desktop I had open previously.
The process of determining which desktop I'm on, and how to switch to other desktops, is the subject for a different topic. But here's an image of the macro:
Thanks for everyone's help!