if not os.path.exists(pipe_name):
    os.mkfifo(pipe_name)
with open(pipe_name, 'r') as pipe:
    print('Listening for actions...')
while True:
    action = pipe.readline()[:-1]
if action == '':
    print('No clients. Sleeping...')
time.sleep(1)
Межпрограммное взаимодействие на питоне в Linux