OP surely already knows this, but for everyone else in this thread - for live music coding, got to mention Sonic Pi (https://sonic-pi.net and https://github.com/sonic-pi-net/sonic-pi) which is absolutely amazing at what it does; it's Ruby and not Python, but some ideas are quite brilliant.