Get the name of the window currently in use via script

So its a pretty simple task, I just cant find the right function to do it.

Im aware of system.nav.getCurrentWindow(), but I believe this gets the name of the current main screen window. I would like to know the name of the window a function was called from (for example, a popup). I think theres a property in the window that I can use to view the name, but it doesnt exactly fulfill my needs (as outlined below).

So heres what Im trying to accomplish. I am writing a function that is shared across many projects. The function will be called in the except scope of a try. Originally I set up this function to take a window path as a parameter, but I’d like to see if I can skip this by getting it automatically with a function. Im not in dire need of this, to enter the window path manually is easy, but I’ll bite at any step I can skip.

Does anyone know of a simple way of doing this?

Thanks for any help.

system.gui.getParentWindow(event).getPath()

Works for me in 8.0.10.