samuelcolvin / watchfiles

Simple, modern and fast file watching and code reload in Python.
https://watchfiles.helpmanual.io
MIT License
1.72k stars 108 forks source link

[Question] Possible to run multiple watch processes at once? #279

Closed pallavg closed 1 month ago

pallavg commented 3 months ago

I want to know if it is possible to run mulltiple watch process in a single script that watches 2 separate directories and runs different callback functions. Something like this:


from watchfiles import run_process

def callback1():
 ....

def callback2():
 ...

def main():
     run_process(dirs1, target=None, callback=callback1, step=30000)
     run_process(dirs2, target=none, callback=callback2, step=500000)
     ...
     run_proccess(....)

Thanks.

samuelcolvin commented 1 month ago

No idea, best to try it.

In principle, I think it should work.