$(document).ready(...) in jquery to initialise your scripts and in python, it would be creating a single function called main then call that.
Most older (pascal and fotran for example) and C-based languages (Java, C++,C and C#) actually use a common entry function or method to start with. In fact, it’s actually more specifically compiled languages.
Python is a scripting language so it executes whatever is not inside a function first, top to bottom and only when functions are called do they execute. This would be more like windows batch files or powershell scripts.