title: Python - For loop and threads doesn't want to work together?
body: <p>So iam playing around with threads now and I have come to the stage that the thread indeed works but I think i'm having issue with for loop. So the for loop works only inside the code but whenever I want it to run through entire whole code. Then it will just take the last object in the Json file.</p>
  
  <p><strong>The code</strong></p>
  
  <pre><code>#Read json File
  with open('config.json', 'r', encoding='UTF-8') as json_data:
      config = json.load(json_data)
  
  threads = []
  for i in range(len(config)):
      p = threading.Thread(args=(config[i]))
      threads.append(p)
      p.start()
      print()
      print(config[i])
  
  
  NameUrl = config[i]["Url"]
  
  myNote = config[i]["My-Note"]
  
  def checkoutNames(NameUrl, nameID):
  
  #Request &amp; other codes - Removed to recude the code
  #......
  #......
      headers = {
          'Referer': '',
          'Content-Type': ''
      }
      payload = {
          "shared": {
              "challenge": {
                  "email": config[i]["Email"],
                  "PersonNumber": config[i]["PersonNumber"],
                  "postal_code": config[i]["ZipCode"],
                  "given_name": config[i]["Name"],
                  "Last_name": config[i]["LastName"],
                  "street_address": config[i]["Address"],
                  "postal_code": config[i]["ZipCode"],
                  "city": config[i]["City"],
                  "country": config[i]["Country"],
                  "email": config[i]["Email"],
                  "phone": config[i]["Phone"],
              }
  
  def checkoutNotes(NamesUrl, NamesPost):
  
  #Request &amp; other codes - Removed to recude the code
  #......
  #......
  
      headers = {
          'Accept': 'application/json, text/javascript, /; q=0.01',
          'Accept-Language': 'en-US,en;q=0.5',
          'Accept-Encoding': 'gzip, deflate, br',
          'Referer': NameUrl,
          'Connection': 'keep-alive'
      }
      payloadInfo = {
          "Information": {
              "Color": config[i]["Color"],
              "house_number": config[i]["houseNumber"],
              "year": config[i]["Year"]
        }
      }    
  def wipe():
      os.system('cls' if os.name == 'nt' else 'clear')
  
  def main():
      time.sleep(1)
  
      FindName(myNote)
  
  if _name_ == '_main_':
      try: {
          main()
      }
      except KeyboardInterrupt:
          wipe()
  </code></pre>
  
  <p>So as you can see the code there is a thread at the beginning but I don't know the issue why it doesnt go through the whole code? maybe any see the issue?</p>
  
  <p>This is the issue </p>
  
  <pre><code>    threads = []
  for i in range(len(config)):
      p = threading.Thread(args=(config[i]))
      threads.append(p)
      p.start()
      print()
      print(config[i])
  </code></pre>