I meant the first approach, where you would call:
if __name__=='__main__':
    main()

to start the training. Inside main() all objects would be created (as in your first approach) and the training will be started. Make sure to pass all needed objects as arguments to train().