The spirit of man when in nature feels the ever-changing conditions of nature. When he binds himself to things ever-changing, a good or evil fate whirls him round through life-in-death.
The Bhagavad Gita
When you attach your self to your projects — more accurately: the outcomes of your projects — you lose freedom, and consequently, control over your life and your happiness. All those projects, and all the decisions you make working on them are transient, and as time progresses you’ll learn to do things differently, to do things better. Learning from failure is impossible if you consider the failure of a project to be a failure of your self. Consider the opposite: learning from failure is the success of your self because doing something, failing and growing stronger by gaining new experience is much better than doing nothing, failing by default and learning nothing.
Instead of attaching yourself to the outcomes of the things you’re focusing on now, detach yourself and be like water. Flow freely from failure to success, or from success to failure. What counts is movement and the freedom to move, not your current position — something that is guaranteed to change.