-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?

Hue
  • 13
  • 2
  • 3
    Duplicate of [How can I use threading in Python?](https://stackoverflow.com/questions/2846653/how-can-i-use-threading-in-python) – esqew Dec 18 '21 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 – Copperfield Dec 18 '21 at 22:31

1 Answers1

1

Yes, you can. Use threading as suggested:

from threading import Thread

def one():
    ...

def two():
    ...

Thread(target=one).start()
Thread(target=two).start()
RiveN
  • 2,595
  • 11
  • 13
  • 26