title: How to return a value from Python script as a Bash variable?
body: <p>This is a summary of my code:</p>
  
  <pre><code># import whatever
  
  def createFolder():
      #someCode
      var1=Gdrive.createFolder(name)
      return var1 
  
  def main():
      #someCode
      var2=createFolder()
      return var2
  
  if __name__ == "__main__":
      print main()
  </code></pre>
  
  <p>One way in which I managed to return a value to a bash variable was printing what was returned from <em>main()</em>. Another way is just <em>printing the variable in any place of the script</em>. </p>
  
  <p>Is there any way to return it in a more <em>pythonic</em> way?</p>
  
  <p>The script is called this way:</p>
  
  <pre><code>folder=$(python create_folder.py "string_as_arg")
  </code></pre>