There are a lot of mods that allow you to do exactly that.
My favorite that does exactly as you mention is KOs (Kerbal OS). It's basically a programmers interface for it, allowing for really precise control.
A YouTuber, Scott Manley, has a pretty good (albeit old) video on the topic.