query = 'process_name'
ps_process = Popen(['ps', '-A'], stdout=PIPE)
grep_process = Popen(['grep', query], stdin=ps_process.stdout, stdout=PIPE)
ps_process.stdout.close()
output = grep_process.communicate()[0]
Команда подпроцесса Python с каналом