title: Python - Unexpected Import Behavior
body: <p>I have a file called <code>Utility.py</code> which is essential a menu that will call a set of tools.</p>
  
  <p>In that folder there is a <code>core_fuctions</code> folder with a nested folder called <code>powershell_tools</code> Inside of <code>powershell_tools</code> there is  a file called <code>test_tools.py</code> which is the menu of PowerShell tools.</p>
  
  <p>Each folder has <code>__init__.py</code> in it. When I call my Utility it immediately opens in to the test_tools.py file instead of the utility.py menu. I have an exit option and it exits to the Utility.py menu. I'm not sure why it is starting where it does.</p>
  
  <p>Here is an abbreviated version of the utility file:</p>
  
  <pre><code>from core_functions.powershell_tools import test_tools
  import os
  
  os.system("cls")
  while True:
      print "\n"
      print "Select operation."
      print ....
      print "Press 4 to Use Powershell Tools"
      print "Press 5 to Exit"
      print "\n"
  
  choice = raw_input("Enter your choice: ")
  
  if choice == "1":
      verbose = raw_input("\nWould you like to run in verbose mode? (yes) or no: ")
      if verbose == "no":
          print "hi"
      else:
          print "yup"
  
  elif choice == "4":
      test_tools()
  
  elif choice == "5":
      os.system("cls")
      break
  
  else:
      os.system("cls")
      print "\nPlease enter a valid operation."
      continue
  </code></pre>
  
  <p>So that is the menu I would expect to be dropped off in when I launch utility.py. However, I am dropped of in the test_tools.py file when I launch Utility.py</p>
  
  <p>test_tools.py looks like this:</p>
  
  <pre><code>from tools.ps_cli import *
  from tools.remote_ps_session import *
  from tools.ps_clear_remote_dns_cache import *
  from tools.ps_get_remote_system_local_users import *
  from tools.ps_md5_hash import *
  from tools.ps_remote_system_uptime import *
  from tools.ps_unlock_account import *
  
  while True:
      print "\n"
      print "Select operation."
      print "Press 1 to test ps_cli.py"
      print "Press 2 to test remote_ps_session.py"
      print "Press 3 to test ps_clear_dns_cache.py"
      print "Press 4 to test ps_get_remote_system_local_users"
      print "Press 5 to test ps_md5_hash"
      print "Press 6 to test ps_remote_system_uptime"
      print "Press 7 to test ps_unlock_account"
      print "Press 'a' to exit"
  
  
      choice = raw_input("Enter your choice: ")
  
      if choice == "1":
          ps_cli()
      elif choice == "2":
          remote_ps_session()
      elif choice == "3":
          ps_clear_remote_dns_cache()
      elif choice == "4":
          ps_get_remote_system_local_users()
      elif choice == "5":
          ps_md5_hash()
      elif choice == "6":
          ps_remote_system_uptime()
      elif choice == "7":
          ps_unlock_account()
      elif choice == "a":
          break
  
  
      else:
          os.system("cls")
          print "\n\n\nPlease enter a valid operation."
          continue
  </code></pre>
  
  <p>I can't figure out why the import is causing it to launch test_tools and not launching when I press 4 in utility.py</p>
  
  <p>Here are some screenshots of behavior:</p>
  
  <p>On launch of Utility.py</p>
  
  <p><a href="https://i.stack.imgur.com/agAOD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/agAOD.png" alt="enter image description here"></a></p>
  
  <p>After pressing 'a' to exit (This is where things should start): </p>
  
  <p><a href="https://i.stack.imgur.com/2zTLn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2zTLn.png" alt="enter image description here"></a></p>
  
  <p>After attempting to go back in to test_tools.py by pressing 4:</p>
  
  <p><a href="https://i.stack.imgur.com/MsArI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MsArI.png" alt="enter image description here"></a></p>
  
  <p>So the TL;DR is this. Why is my program launching directly in to the imported module and why can't it return to it after leaving? I'm definitely new to Python but haven't had this issue with imports before - though they haven't been in multiply nested directories.</p>
  
  <p>Thanks for any help!</p>