title: Returning from a function while continuing to execute
body: <p>I am working on a Django application where I would like to populate several fields within my model when an object is first created. Currently I am able to do this in the <code>save()</code> routine of my model like so:</p>
  
  <pre><code>def save(self, *args, **kwargs):
      file = fileinfo.getfileinfo(self.file_path)
      if not self.file_size:
          self.file_size = file.FileSize
      if not self.file_inode:
          self.file_inode = file.FileInode
      if not self.duration:
          self.duration = file.Duration
      if not self.frame_width:
          self.frame_width = file.ImageWidth
      if not self.frame_height:
          self.frame_height = file.ImageHeight
      if not self.frame_rate:
          self.frame_rate = file.VideoFrameRate
      super(SourceVideo, self).save(*args, **kwargs)
  </code></pre>
  
  <p>I created a function called <code>getfileinfo</code> within a separate module called <code>fileinfo</code>. This is what part of my function looks like:</p>
  
  <pre><code>def getfileinfo(source):
      fstats = os.stat(source)
      info = dict({
          u'FileSize': fstats.st_size,
          u'FileInode': fstats.st_ino
      })
      output = subprocess.Popen(
          [exiftool, '-json', source], stdout=subprocess.PIPE)
      info.update(
          json.loads(output.communicate()[0], parse_float=decimal.Decimal)[0])
      return DotDict(info)
  </code></pre>
  
  <p>Although all of this works, I would like to avoid blocking the save process should the retrieval process be delayed for some reason. The information is not needed at object creation time and could be populated shortly thereafter. My thought was that I would alter my function to accept both the file path in question <strong>as well</strong> as the primary key for the object. With this information, I could obtain the information and then update my object entry as a separate operation.</p>
  
  <p>Something like:</p>
  
  <pre><code>def save(self, *args, **kwargs):
      fileinfo.getfileinfo(self.file_path, self.id)
      super(SourceVideo, self).save(*args, **kwargs)
  </code></pre>
  
  <p>What I would like help with is how to return from the function prior to the actual completion of it. I want to call the function and then have it return nothing as long as it was called correctly. The function should continue to run however and then update the object on its end once it is done. Please let me know if I need to clarify something. Also, is thing even something work doing?</p>
  
  <p>Thanks</p>