The simple answer is with difficulty. A window (or door) can only be placed in a WALL. So the only way to do this is by ‘calling’ the window using the objects script. BUT this will only work graphically because the result will not be neither an wall nor a window. It will be an object.
Why do you want to do this? what is your workflow?