I tried hanging myself due to depression yesterday, today I can't get a boner, could a failed suicide attempt cause ed?

Erections. Erections are more about mental health rather than physical health. Your poor brain is probably overloaded. There is no one on this website that wants to see you try to hang yourself again. Please please pause here. Please get some help. You can anonymously call the county crisis line where you live to get immediate help that can maybe change your life. Thank you for asking for help here.
Hey man... I just wanted to tell you how glad I am that you failed your suicide attempt. Of folks who've failed 99% are glad one year later that they are alive. Nobody's going to get an erection when they're this upset, and don't worry -- your life is going to better, and it's almost certain you'll find someone special to love in every way possible.