1
have a question. A few days ago I am creating an application with GUI interface to show movie schedules. It was built in modules, for example, a module takes care of the images, searches the web and download. Another module takes care of other information such as looking for synopsis, film budgets, actors. Another, takes care of picking up schedules and information from the cinema and another from the GUI.
My question is, how to connect these modules? Because not everything in the module is within function. The imaging module lowers the film covers by means of a is out of a function.
How do I get my main module to run all the module code? I have to turn everything into a function?
This project is being done only to help me learn. Thanks in advance :)
The @nbro answer is appropriate to your question. On the other hand, there is a comment to be made. Many consider it a bad practice to put executable instructions in their modules (or on
__init__.py
of your Packages). The argument is that it is an unexpected behavior. When you import a module you normally expect it to just define some objects (constants, classes, functions, etc.) If your modules have too much code like this, one day it may be difficult to understand some bug or move things from one module to another. At least I’ve experienced this kind of problem a few times.– sergiopereira