-4

I have two scripts. One of them checks out an online database and the other one checks a telegram bot. Both of them run in loop, but they take some time to check the updates, so I'd like to run them separately. Can I do that?

2
  • 3
    Duplicate of How can I use threading in Python? Commented Dec 18, 2021 at 22:12
  • yes you can, you can either start both script manually for separate or you can run the both with any of the concurrent mechanism available such a threads of multiprocesses Commented Dec 18, 2021 at 22:31

1 Answer 1

1

Yes, you can. Use threading as suggested:

from threading import Thread

def one():
    ...

def two():
    ...

Thread(target=one).start()
Thread(target=two).start()
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.