title: Trying to Process All Python Functions Simultaneously
body: <p>I am trying to process a text file and its sentences. I split the text into sentences and process individual sentences by some python functions. </p>
  
  <pre><code>with io.open ("articles.html", encoding="utf-8") as myfile:
      data = myfile.read()
      data = data.split('\n')
      myfile.close() 
  </code></pre>
  
  <p>Basically, I process each sentence depending on its length and some regular expressions filters. I have stored my python functions (i.e. process_movie_1, process_movie_2, process_movie_3) in other files and import into the main script.</p>
  
  <p>I call each sentence using a for loop. With the current structure, my script processes one sentence/one function at a time in the for loop. I need to modify the script so that I can process each sentence simultaneously (at the same time). I need your ideas, and I may want call all these functions from the main script or fork it. I think some of you may come up with a better idea. Right, now I am using an IDE to call my main script but I'm am ready to use command prompt to process all the sentences at the same time. I can also use any open source software that might help me considering my situation.    </p>
  
  <pre><code>from clip1 import *
  from clip2 import *
  from clip3 import *
  from clip4 import *
  
  for idx, sentence in enumerate(data):
  
      serial = str(idx) 
      folder = str(idx)
  
      string = str(sentence)
      tokens = TextBlob(string)
      wordcounts = len(tokens.words)
  
  
      sep = re.split('; |\*|\n|--', string)
  
  
      if len(sep) == 2:
  
          a, b = [str(e) for e in sep]
          a = TextBlob(a)
          b = TextBlob(b)
          idx, len(tokens.words), len(sep), len(a.words), len(b.words), sep
  
          if (0 &lt;= wordcounts &lt;= 4):
  
              len(tokens.words), sentence, sep
              a, b = [str(e) for e in sep]
              a = TextBlob(a)
              b = TextBlob(b)
              len(a.words), len(b.words), sep, sentence
  
              process_movie_1(folder, gradient, fontface,
                               fontface_italic, highlight,
                               highlight_color, font_color, key_color, 
                               first_key, second_key, third_key, string, 
                               stroke_color, stroke_width, txt_under_color, 
                               serial)        
  
  
  
          elif (5 &lt;= wordcounts &lt;= 6):
  
              len(tokens.words), sentence, sep
              a, b = [str(e) for e in sep]
              a = TextBlob(a)
              b = TextBlob(b)
              len(a.words), len(b.words), sep, sentence
  
  
              process_movie_2(folder, gradient, fontface, fontface_italic, highlight, 
                               highlight_color, font_color, key_color, 
                               first_key, second_key, third_key, string, 
                               stroke_color, stroke_width, txt_under_color, 
                               serial)
  
  
  
          elif (7 &lt;= wordcounts &lt;= 15):
  
              len(tokens.words), sentence, sep
              a, b = [str(e) for e in sep]
              a = TextBlob(a)
              b = TextBlob(b)
              len(a.words), len(b.words), sep, sentence
  
              if (1 &lt;= len(a.words) &lt;= 3): 
                  print idx, "(clip29 -- done)", len(tokens.words), sep
  
  
                  process_movie_3(folder, gradient, fontface, fontface_italic, highlight, 
                                   highlight_color, font_color, key_color, 
                                   first_key, second_key, third_key, string, 
                                   stroke_color, stroke_width, txt_under_color, 
                                   serial)
  </code></pre>