I swear I have seen this done before but can not find it now. Is it possible to have a shell script start a python interpeter "mid stream", ie:
#!/bin/bash
#shell stuff..
set +e
VAR=aabb
for i in a b c; do
echo $i
done
# same file!
#!/usr/bin/env python
# python would be given this fd which has been seek'd to this point
import sys
print ("xyzzy")
sys.exit(0)