0

I am trying to access a list from 2 functions , but the problem is they will both access the same data.

My ideas are not working , the original idea was this:

mylist= ['string1','string2'.......'stringx']

def func(string):
....

def spawn_thread(string):
Thread(target = func(string)).start()
...

def start():
for something in mylist:
      spawn_thread(something)

On the first time string1 is used , i need on the second run string2 in a different thread.

First thread:

func(string1) -> func(string3) -> func(string5)

second thread:

func(string2) -> func(string4) -> string(string6)

Or is there any other way / better way to achieve this ?

Padraic Cunningham
  • 176,452
  • 29
  • 245
  • 321

0 Answers0