I have two scripts say script1.py on PC1 and script2.py on PC2. Now, script1.py has two methods as shown below. The method1() on PC1 must be completed before method2() on PC2 can be executed. So, how can I trigger method2() of script2.py on PC2 which is already running?
I can split script2.py into two different .py files i.e method1.py and method2.py on PC2 and call method2.py after script1_method2() on PC1 has finished but then I need to pass the foo object to it. Maybe I can pickle the foo object and read it from a file?
Is there a better way to go about this?
Note: I can communicate between PC1 and PC2 using paramiko ssh
def script1_method1():
"""
This is on PC1
get connection from PC2 script 2 and do some work
"""
pass
def script1_method2():
"""
This is on PC1
work which needs some time
only after this work is done, call PC2 script2
"""
pass
def script2_method1():
"""
This is on PC2
create an object 'foo' which connects to PC1 script1
return object 'foo' to main
"""
pass
def script2_method2(foo):
"""
This is on PC2
get object 'foo' and do some work with it
"""
pass