As title. I want to move code segment if __name__ == '__main__': before all functions that it will call.(I found this more readable, for myself) To achieve this I need to call functions that will be defined later. Is this possible?
While this has been answered in the comment section. To provide more context: I read one line of code:
cur_mod = sys.modules[__name__]
which let me came to this question. (i.e. I thought it would be possible to call something defined later by import itself)
if __name__ == '__main__':below all the defined functions. Just call functions as necessary below this line.if __name__block.def mainat the top which you call at the bottom…?if __name__ == __main__call into yet another function, and put it at the very top of the file... Then just call that function and it will do the same thing