Yamaha 150XA trim issue

I was running boat today and all of a sudden every time I trim motor up or down while running on plane the motor cuts back. It does not do it if in neutral. Motor is a 2013 Yamaha 150XA. Any help is appreciated.

What do you mean" cutback"? The Trim pump is electric and don’t see how it can effect the running of the engine!

Every time I hit the trim button it loses electrical power.

The engine may need to have a battery connected to it at all times to stay running; if so yuu may have a short/bad connection/bad ground somewhere in the system that shows up when you trim it. Do any electronics shut off when this happens? I would check battery connections and battery switch connections.

97 Carolina Skiff Suz DF60