I am trying to create a simple chat application using sockets(UDP) and i would like to make it automatically allow itself through firewall, like every other application does. Is there a simple way to do this?
The whole idea of a firewall is that it decides who gets through and who doesn't.  So in principle, this is not possible, and that's a good thing!
Most firewalls, however, are configured to allow e.g. web traffic (port 80) to pass.  So you have to find out what ports your firewall has open, and use these.
How do i make a python program allow itself through firewall?