A program that lives in one file stops being pleasant to work in long before it stops working. Python’s answer is the module: any .py file, whose names other files can borrow with import. Python itself ships with hundreds, and your own are written the same way.
More lessons in Complete Python Programming