title: How can I print a variable inside a function from a different file?
body: <p>I am making a game and I need to print a variable from a function that is in another file. I have tried making them global, but I still get the error.</p>
  
  <p>Function file:</p>
  
  <pre><code>from Computers import YourComputer
  from Computers import Computer1
  
  def StartNetwork():
  
      global routerIP
      global username
      global password
  
      routerIP = "192.168.0.0"
      username = "admin"
      password = "password"
  </code></pre>
  
  <p>Script:</p>
  
  <pre><code>from Network import StartNetwork
  
  def Terminal():
      x = 1
      while x == 1:
          cmd = input("&gt; ")
  
          if cmd == "network_info":
              print(routerIP)
  </code></pre>
  
  <p>Error: </p>
  
  <p>File "C:\Users\user\Desktop\PythonGame\Terminal.py", line 9, in Terminal
      print(routerIP)
  NameError: name 'routerIP' is not defined</p>