title: Run Python Procedure From Another Python File
body: <p>I am having problem's calling one python procedure from another. This solution would likely not justify an "import".</p>
  
  <p>The problem is that one Python script has an active Bluetooth connection to a device. I need information from a second Python script to be sent through the Bluetooth port of the first python script.</p>
  
  <p>Essentially, the first python file (file1.py) has this sub:</p>
  
  <pre><code> def output(string):
  
         bluetoothsock.send(string)
  </code></pre>
  
  <p>And the second file should be able to do something like this:</p>
  
  <pre><code>file1.output("randomtext")
  </code></pre>
  
  <p>And the first python file should send the "randomtext" string. Any ideas would be helpful!</p>
  
  <p>File1.py example:</p>
  
  <pre><code>from bluetooth import *
  try:
     sock.connect((target_address, port))
     sock.settimeout(timeout)
  except:
     print("Timeout",3)
  
  
  def output(text):
     try:
        sock.send(str(text))
        return ("Sent Successfully!",True)
     except:
        return("Error Sending",False)
  </code></pre>