Interactive: ssh -t 127.0.0.1 python
Use bash -l
Example:
#!/bin/bash -l
# your scriptMain application: write block/multiline content to some file
<< EOFFFF > sy.txt
line 1
$TERM
EOFFFFcontent in sy.txt:
line 1
xterm (maybe)
Change the beginning of the 1st line to << "EOFFFF" or even
<< E"OF"FFF or << EO'F'FFF to get the raw string $TERM in the 2nd
line of sy.txt.