Sounds like an electrical problem. First push the plug back into the wall AND into the sewing machine. 2d Check the plug/cord for electrical continuity. If you get continuity part of the time when you move the plug around, replace the plug. If the problem is at the end which plugs into the machine, you'll need a new cord. If the cord is good, but it still doesn't work, you'll need to take it in for service.
Sue