Can you paint the engine bay with the engine still installed?

I removed everything except the engine and wiper motor. It came out ok, not great but good enough for my liking.