process = subprocess.Popen(['/bin/bash'], shell=False, stdin=subprocess.
    PIPE, stdout=subprocess.PIPE)
process.stdin.write('echo it works!\n')
process.stdout.readline()
process.stdin.write('date\n')
process.stdout.readline()
Interacting with bash from python