Direct swap
Yep, it's pretty much a direct swap of the flywheels and ignition assembly. The two aluminum flywheels will look almost the same except for the number of magnets cast in. The magneto ignition and coil assembly looks almost the same, except that the one has two small coils on the bottom (they are 3 amp, AC lighting coils). There are two positive (AC) wires coming off, plus a ground or stop wire for the engine ignition. You can use either of the positive leads to a headlight, and ground the other terminal to the bulb. This will work even with a 12 vDC bulb, but it will dim at low engine speed.
When swapping the flywheels and ignitions, you have to adjust the clearance between the main ignition coil from the flywheel when mounting. I'm told the gap or clearance on this is the thickness of a standard business card.
You can swap these parts directly between hs40 motors, and even hs50 motors. Newer motors have flywheels with taller vanes and boxier shrouds, but the older flywheels will work in either shroud. This may mean that you may have to keep shroud with it's matching flywheel, but they mount the same.