Electric motors perform a lot of functions in a car:
Check or replace the motor fuse.
The electric motors for the power window and the sunroof have automatic fuses that are switched off from overloads and turn on after a while. The reason for the deviation may be frozen glass or dirty window rails.
A fuse blowing again indicates a short circuit.
To accurately determine the defect of the motor, connect the motor with two wires, about 2 mm in diameter, to the battery. Positive wire to the positive terminal, negative wire to the negative terminal of the motor. If the engine runs well, then the defect was in the power supply. Slow and intermittent rotation of the motor indicates worn carbon brushes. Replace brushes.
If the motor is running, determine (according to the electrical diagram) a wire that supplies power when the switch is turned on and before that the ignition is turned on.
Check the lead wire. As a probe, you can use an ordinary incandescent lamp, with a sharp needle, at the end of the wire of which you can dig the wire.
If there is no voltage at the motor terminals, the power supply is defective. Determine the defect using the electrical diagram and eliminate it. Motors are often switched on via an intermediate relay, so the relay should be checked.
Finally check the switch.
If the wire is damaged, it is better to lay a new wire.