How do i control a subprocess pipe if i run "python -m pdb script.py"

I’m trying to run a subprocess where i can run pdb “python -m pdb script.py” and pass in inputs from my main process and read the return lines from pdb.
Need help, thanks!