title: python interpreter running shutdown code when I don't want it to
body: <p>I'm using Python 3. I'm still learning but am, let's say, an intermediate at other programming languages. I'm building a simple GUI that just does simple things for now but will add on more things as I go. I've got some success. Then I had an idea, to have a function (or whatever it's called in Python) to run an external script, stored in my script folder. So I wrote this...</p>
  
  <pre><code>def runscript(scriptname):
      from subprocess import call
      call(['scripts/'+scriptname])
  </code></pre>
  
  <p>Then later on in my code I have this...</p>
  
  <pre><code>sdb = Button(topbar, text="Shutdown", command= runscript("shutdown.sh"), font=("Helvetica", 20), width=18)
  </code></pre>
  
  <p>shutdown.sh is a simple script that does what you might expect it to.</p>
  
  <p>Now whenever I run the python script with python3 MyScript.py the machine instantly shuts down! I obviously only want it to shut down when I click the Shutdown button. From reading I gather it's to do with the fact that Python executes every line as it goes. So I don't understand why there are plenty of examples around on the internet for functions that will shutdown your PC, whereas my more general script-running code doesn't work in any useful way.</p>