Skip to content

Instantly share code, notes, and snippets.

@navinthenapster
Created May 8, 2019 11:54
Show Gist options
  • Save navinthenapster/e0c0f4ff8be36985cecc6c4f98a0ca33 to your computer and use it in GitHub Desktop.
Save navinthenapster/e0c0f4ff8be36985cecc6c4f98a0ca33 to your computer and use it in GitHub Desktop.
Creating the signal in the python program for inter process communication
from pydispatch import dispatcher
SIGNAL = 'my-first-signal'
def handle_event( **kwargs ):
"""Simple event handler"""
print 'Signal was sent by', kwargs['message']
dispatcher.connect( handle_event, signal=SIGNAL, sender=dispatcher.Any )
first_sender = "sender"
second_sender = "sender"
def main( ):
dispatcher.send(message="test", signal=SIGNAL, sender=first_sender )
dispatcher.send(message="test1", signal=SIGNAL, sender=second_sender )
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment