Try checking all wiring connections and plugs. Clean with WD40 and a small wire brush. Find a wiring diagram and trace the wires from the alternator stator and all ground connections. On a bike that old the fuse holders crumple from age. Replace the fuse block with a new automotive fuse block and connectors. There is no kickstand switch, the neutral switch is only for the starter and there is a switch on the clutch lever to prevent starting in gear. Is your bike getting fuel? is the cylinder compression high enough? Check for air leaks at the carb boot rubbers, there is a rubber hose from right carb intake to the vacuum fuel petcock check for air leaks. Try a jumper cable to a 12v car battery to the battery terminal and try kick starting. The symptom of a bad ignition module is after 5 minutes of running one cylinder will drop out. Check you original coils with an ohm meter, The primary resistance for the ignition coil of a 1979 Yamaha XS400 is typically around 0.18 to 0.24 ohms. It's important to ensure that any replacement coils are within this range to avoid potential issues. To run properly you need Spark, fuel and good compression. Try one thing at a time, too many changes you'll never figure out the problem.