Forum Discussion

richardpresc0tt's avatar
richardpresc0tt
Frequent Visitor
29 days ago

Scope of Browsers, Aliases, etc.

I respect the technical depth of the issues the community is struggling with, but I gotta ask this scratch-the-surface question that's holding up my work.  I'm using TestComplete 15.79.5.7 x64:

1. Put this code in a Python script (inside TestComplete of course):

def OpenChrome() :
  browser = Browsers.Item[btChrome].Run("http://secure.smartbearsoftware.com/samples/testcomplete11/WebOrders/login.aspx")

 2. Run that function and it will open the Chrome browser and go to that page, with green 'Pass' result.

3. Now make a second Python script with this content:

from <your_first_Python_script> import *

def CallOtherFunction():
  OpenChrome()

4. Run that function and it fails immediately saying:  NameError: name 'Browsers' is not defined

I've tried a few things to resolve this, but no good.  Any ideas for letting separate script files call each other's functions when those called functions use TestComplete resources like Browsers, Aliases, etc.?