from ProjectName.PackageName1.class1 import CLass1
from ProjectName.PackageName1.class2 import CLass2
Class Main_input:
obj1 = Class1()
obj2 = Class2()
list_of_args = obj1.function1(args)
if __name__ == "__main__":
p1= multiprocessing.Process(target=obj2.function2, args=list_of_args)
p1.start()
p1.join
When I am running the above code I am expecting
- the function1 of Class1 to run first - This will return a list_of_args
- Create a process p1 which will run Function2 of class2, iterating over the list_of_args wherein the items in the list will be divided into the processes and the function will run concurrently of different values
What is happening
- The function1 is running fine and returning list_of_args BUT when I create a process and I start the process, it is again running the below code again and again
list_of_args = obj1.function1(args)
How should I fix this?