making elgamal.py a package.  You can generate keys.  Then use the encrypt() and decrypt() functions.