[Solved] main program while loop


No, you do not need a main loop if you use the cmd.Cmd class included with Python:

#! /usr/bin/env python3
import cmd

class App(cmd.Cmd):

    prompt="Type in a command: "

    def do_a(self, arg):
        print('I am doing whatever action "a" is.')

    def do_b(self, arg):
        print('I am doing whatever action "b" is.')

if __name__ == '__main__':
    App().cmdloop()

The documentation for the cmd module includes an example near the bottom to help get you started.

2

solved main program while loop