Firstly, sorry for my silly headline :) And here is my problem .. Actually this is not a problem. Everything works, but I want to have a better structure ...
I have a python script with a looped loop every second. There are a lot of IFs in the loop. Is it possible to put each IF in a separate file and then include it in a loop? Thus, every time the loop is โloopedโ, all IFs will also be transmitted.
My script has too many conditions, and all of them are generally different from the others, so I want to have some kind of folder with modules - mod_wheather.py, mod_sport.py, mod_horoscope.py, etc.
Thanks in advance. I hope I wrote everything thatโs clear ...
EDIT: Here is a structural example of what I have now:
while True: if condition=='news': #do something if condition=='sport': #so something else time.sleep(1)
Well, if I had something like this:
while True: import mod_news import mod_sport time.sleep(1)
And these IFs from the first example will be separated in the files mod_news.py, mod_sport.py ...
source share