title: How to create a common function to execute a python script in Jenkins
body: <p>I have a common python script which need to use in multiple pipeline jobs. 
  What I did is create a qroovy file with common method as below.</p>
  
  <pre><code>def create_slaves()
  {
      def cmd = 'python "-u my_script.py'
      def proc = cmd.execute()
      proc.waitfor()
  }
  return this
  </code></pre>
  
  <p>execution threw this exception.</p>
  
  <pre><code>Scripts not permitted to use staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods execute java.lang.String
  </code></pre>
  
  <p>So I feel like this is not the correct approach. Someone has a clue about a suitable way for execute a common python script in pipeline?</p>