A few folks have covered the full-time employment option.

I'll speak regarding the "sell your own stuff" option, which is fairly well-represented in my social circles.

Short version: yes, you can write part-time or full-time on technical topics as an independent technical writer. It requires operating a technical writing business, the key word in which is more often business than technical writing.

There exists a tremendous demand in the world for industrial inputs. Technical writing is often an industrial input. If your book/e-book/video course/screencast/sample source/etc saves an engineering team weeks, it is worth tens of thousands of dollars. If it saves a single team member two days of reading Free Information On The Internet (TM) it handily sails over $50.

You're going to want to write things which are chosen to be about topics which are actually required by folks trying to get things shipped at their day jobs. This suggests aiming at a sweet spot of technologies which are past their up-and-coming-hotness phase and getting taken up rapidly, but are still not terribly understood. Think React, but perhaps not Rust. (Though one could certainly make a lot of money with Rust books.)

Writing independently involves, above all things, cultivating an audience and then selling into it. This almost invariably means get people's email addresses and sell primarily via email. The easiest way to get people's email addresses voluntarily is to write about related topics in a free and open fashion (on your own web presence to maximum extent possible) and include a call to action which gives people some valuable thing for free in return for their email and permission to email them ~2X a month with other things they'll enjoy. That "valuable thing" is often a short, concise guide on a topic (maybe a downloadable React cheatsheet or 10 quick anti-patterns) and the "things they'll enjoy" is simply blog posts about the topic delivered regularly until you launch.

This provides your future customers with demonstrative evidence that you know what you're talking about and that they'll enjoy your writing, which makes it vastly easier to sell them a book in the cozy little space you've created for yourself than putting the book with 250 other books on a shelf at Barnes and Noble.

You're typically going to sell your book in a multi-package format: $49 for the book proper, $99 for book-plus-something, $249 for book-plus-more-somethings. Often those options include multimedia -- screencasts of you walking through things or executable code samples are fairly common, as are recorded interviews with people relevant to your audience. I tend to think screencasts/code samples are higher value but interviews are high perceived value and very easy to produce.

After you've launched, congratulations! Now you just keep doing what you're doing -- write more blog posts, send more emails, occasionally add new products to the mix using the same rough formula.

There exist quite a few people who make substantial money as self-published technical authors. Many come out to events like BaconBiz and/or Microconf. I'm not sure whose numbers I have permission to quote off the top of my head, but people post postmortems to HN on a fairly regular basis. Suffice it to say many did better than I did last year, or "competitive with mid-career software engineering jobs in the Bay Area" as a different (higher) bar.

Amy Hoy, Brennan Dunn, and Nathan Barry have copious blog posts about the practical life of an Internet-enabled author, virtually all of which extends directly to technical writing. (All of them write or have written in a self-published format on topics directly adjacent to technical writing. I'm recommending them less to tell you how to break down concepts about Python and more for advise on sales/marketing of information as a product.)

[Edit to add: I mentioned self-published several times above, but to reiterate: if you take on the risk of business execution, your upside goes way, way, way up from doing this. If you go through a publisher, you will be offered a $5k advance check and get totally shellacked on royalties. Midlist self-published authors work as authors; midlist published authors need day jobs.]