well you can allways issue maya to read and execute the file on disk
BUt yes you can listen to the data yourslef and do whatever you want with it even trough a command port and just lter decide what to do.
QUOTE
because i know you can not send more than one line through wrapping with python("")
Then you know wrong!
python("for i in range(10):\r\n print \"foo\"\r\n print \"bar\"")
works fine for me and it has 3 lines, as does:
python("for i in range(10):\n print \"foo\"\n print \"bar\"")