The solution to this problem is to invoke your classes and functions after you define them. Python does not have any way to forward declare classes or methods so the only option is to put the invocations of functions at the end of the program rather than the beginning. More @Wikipedia
Hover over any link to get a description of the article. Please note that search keywords are sometimes hidden within the full article and don't appear in the description or title.