No-no, I mean if generating code is in a separate Python file, then I can debug it with pdb, I can profile it with cProfile, I can run Pylint on it, - all the standard tools.
I like the idea of everything sharing the same file, too, but it does make working with Python part a bit more difficult.
Also, with keeping it separate, the "every language" part comes up. It doesn't have to by Python if it's a separate code generator. Whatever suits you will work. You can generate code for C in C++. Or assembly in Common Lisp. Everything in anything.