You can use subprocess.Popen
to start the script and the communicate
method to pass it input. Something like this:
import subprocess
p = subprocess.Popen(['./script.sh', '-p', '1234'],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
stdout, stderr = p.communicate(input='password\nauth username\nauth password\n')