I've done this for the last two years with each release of the program. You have to wrap the arg-parsing into a main() func.
gam.py
...func defs...
def main():
...huge tree of ifs to parse arguments...
except:
...last couple of lines...
if __name__ == "__main__":
main()
Then you can import gam and use it's methods or do what I do and write a module and use the oauth and object code from gam. After patching gam.py in this manner, what I do to keep the changes separate so that it's easier to update when new versions come out is to import gam.py into a middle module.
CustomGam.py
from gam import*
def CustomGetInfo(username):
return ...
For your custom funcs you can just copy and paste the original func from gam.py and then change it to suit your needs. Most of my custom funcs return a dict or False so that I can do error checking without the whole castle crashing down.
MyProject.py
from CustomGam.py import CustomGetInfo
def main():
...do stuff...