title: How do I define a turtle in Python without creating a new one?
body: <p>I am coding a game and am using turtles to import images as this is the only way I know, but I am having a problem where when I try to define my turtle outside of its original function (so that I can use it elsewhere), it creates another turtle with the same name rather than making the first turtle actually perform the 'goto' line. Here is an example of the problem that occurs in my code. (This is not from my actual code, however, the problem is the same and isn't affected by my other code:)</p>
  
  <pre><code>import turtle
  
  def example():
      a = turtle.Turtle()
  
  example()
  a.goto(100,0)
  </code></pre>
  
  <p>This gives <code>NameError: name 'a' is not defined</code>. Then when I try to define <code>a</code>, like this:</p>
  
  <pre><code>example()
  a = turtle.Turtle()
  a.goto(100,0)
  </code></pre>
  
  <p>the output is of two turtles with only one of them performing the <code>goto()</code> command.</p>
  
  <p>Thank you for taking your time to read my post, I am new to coding and this has been bothering me!</p>