1st: fire hazard, code violations, insurance won’t pay out.
2nd: This is fine for maybe a shed or ADU but when you start doing this to a home and start thinking big picture, there are some questions that come up, such as most of the cost in solar is the labor. If you’re already mounting panels, inverters, wiring, why not go the extra steps to install solar for the home and gain back a lot more costs when the sun is shining? Why mess around with a small window a/c when for the same amount of work (or less) you can install a mini split with better efficiency?