Years ago I fantasized about making a transformer designed to pass through a window. One coil on the outside, one on the inside. Unfortunately I don’t think you can split the core of a transformer and still get anywhere near the efficiency
Also more recently I learned that these things can vibrate. Which would not be good for a window.
You’d be better off passing a wire ribbon around the sash.
Split transformers for power transmission exist, but are rare. Here's a 3 KW system used for non-contact charging of electric forklifts, industrial mobile robots, and such.[1] 93% efficiency claimed. Probably not worth the trouble just to get power through a window.
Witricity is trying to do the same with electric cars.
You can get flat cables for solar DC wiring designed to pass through the gap in a closed window: https://es.ecoflow.com/products/super-flat-cable?currency=EU...
Good point about the possibility of a roof leak and placing blame. I didn’t think of that.