When D4 flashes on your dash, it means that there is either;
a) a communication error between the ECM and the TCM (Transmission Control Module) OR
b) A problem with one or more TCM controlled devices.
This could be a result of many things. In the case of the engine not wanting to start, it could very well be the P/N safety switch causing the problem. Both the ECM and the TCM take signals from all the engine sensors (TPS, IAC, CTS, O2, etc) so a good place to start with this issue is to see if there are any current or stored codes in your ECM and correct them as needed.
Generally, the D4 light will flash if your TCC (Torque Converter Solenoid) or Shift Solenoids are having problems. The P/N Safety switch is another that will cause this.
One last thing could be at fault here... and I hate to even mention it. The TCN or ECU could be having problems (faulty).
Hope this helps.