Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (19.9k points)

I would like to run a Python script in another Python script. I understand that the best way to do that is importing that script. But I couldn't figure out how I can run that script every 60 seconds. What I have tried so far:

    import time

    import mailyolla

    while(1):

        mailyolla

        time.sleep(60)

and

    import time

    while(1):

        import mailyolla

        time.sleep(60)

Neither worked. What should I do?

1 Answer

0 votes
by (25.1k points)

You can define a main function in your mailyolla module that will do you want it to do. And execute that main function in another script like this:

import time import mailyolla 

while(True): 

    mailyolla.main() 

    time.sleep(60)

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 14, 2020 in Python by ashely (50.2k points)
+5 votes
2 answers

Browse Categories

...