Yes
Structurally speaking, generators and motors are exactly the same. They are generally composed of stators, rotors, end covers, brushes, bases and bearings.
The stator consists of a machine base, a stator core, a wire winding and other structural parts that secure these parts.
The rotor consists of the rotor core, rotor magnetic poles (with magnetic yoke and magnetic pole windings), slip rings (also called copper rings and slip rings), fans and rotating shafts.
Generators and motors are completely reversible. When the rated voltage is applied to the stator windings of generators and motors, the external force rotates to rotate the rotor of the generator or motor to achieve the rated value; Synchronous speed, the stator will generate voltage and emit electricctricity.
Simply because the design is focused, using a generator instead of a motor or an electric motor instead of a generator has an efficiency of only about 70% of the nominal value, so it is generally not replaced, and only those with small capacity will be chosen.