title: Having trouble sending variables between functions within separate files - Python and Tkinter
body: <p>I'm having what seems like a basic problem but I'm not sure how to fix it.</p>
  
  <p>I'm making a program which lets the user draw lines over a canvas. I previously had the entire code in one file but since I'm going to add many new tools it seemed a sensible decision to isolate all functions into separate files.
  However doing this has resulted in problems. Apologies that there's a lot of code to press through. Here's my code:</p>
  
  <p>Root program: root.py (The one I'm actually running)</p>
  
  <pre><code>#Import TKINTER toolset:
  from tkinter import *
  import starting_variables
  
  #Starting variables:
  starting_variables.start_vars()
  
  #Tool width control:
  global tool_width
  tool_width = Scale(control_panel,from_=1,to=32)
  
  canvas.bind("&lt;Button-1&gt;",line_start_xy)
  
  control_panel.pack(side=LEFT,fill=Y)
  tool_width.pack()
  wrkspace.pack()
  canvas.pack()
  
  #Runs window:
  window.mainloop()
  </code></pre>
  
  <p>This file defines all the variables needed from the start: (starting_variables.py)</p>
  
  <pre><code>from tkinter import *
  
  def start_vars():
      #Starting variables:
      line_startx = 0
      line_starty = 0
      line_endx = 0
      line_endy = 0
      mouse_x = 0
      mouse_y = 0
      #Main window:
      window = Tk()
      #Workspace and Canvas:
      wrkspace =  Frame(window, bg="blue",width=640,height=480)
      canvas = Canvas(wrkspace,bg="white",width=640,height=480)
      control_panel = Frame(wrkspace,bg="white",width=32,relief=SUNKEN,bd=5)
  </code></pre>
  
  <p>For some reason, when I run the root program is tells me that in line 10 of root.py control_panel has not been defined, but I ran the function which defines it. What am I doing wrong here?</p>