That said: Writing a book is a long slog. It's hard and frustrating. And at the end of the process, you have an amazing feeling and some money -- definitely less than you would have gotten if you had done consulting during that time, though.
I do corporate Python training. Do companies hire me because I've written books? Not really. But it definitely adds to my credibility.
At the end of the day, I write because I enjoy explaining and teaching, knowing I'm helping people all over the world, and seeing my name on a book cover. If you're doing it for the money, you're almost certainly going to be disappointed. Knowing that I'm working with great professionals who share my goals and want to create the best possible product adds to my motivation.