power interupt

I am running on Lionel o gauge track when I run through a switch my engine stops as if directional button pressed. When I press the button again the train moves in opposite direction. Insulating pins are in the switches. What am I doing wrong.

Your contact rollers are not reaching across the gap in the center rail where it crosses a running rail. Or, a roller is shorting on a running rail, tripping the E-unit. Run the engine (in neutral, with power on) by hand over the switch to find exactly where the problem occurs, then see what’s happening with the rollers at that point.

Thanks that helped was able to fix problem. I am still learning.