Inverter switches off powering as soon its unplugged from mains
Current flows in loops.  That is basic &quot;electrical 101&quot;.  All current 'comes out' the hot wire, and 'flows back' via the neutral wire.
A switch only interrupts the hot wire.  That is enough to break the loop and make the load shut off.
A plug interrupts hot and neutral and safety earthing, because, obviously, it's a plug.
So if you think about it, unplugging interrupts neutral.  Switching does not.  It's all about the neutral.
And more specifically, it's all about illegal and dangerous mess that was made when this was hooked up initially.

On the inverter, only the hot wire was connected through back to the panel.  The neutral was never connected or switched, and so neutral is forced to go backwards through the system via the plug.  This is bad: the hot and neutral wires need to stay together for a variety of reasons.
My guess is this was done so the panel could be &quot;back-fed&quot; so the whole house could be powered (on 650VA inverter that can barely provide 3 amps, lol).  I will guess that this wasn't done with a proper interlock.

I suspect this was done because 1-pole switches (which do not switch neutral) are cheaper than 2-pole switches (which do).