Forum Discussion
tristaanogre
Esteemed Contributor
You can do either this
from Script1 import * def callScript1Methods(): test1() test2()
or this
import Script1 def callScript1Methods(): Script1.test1() Script1.test2()
Notice in the second example, you need to explicitly indicate the unit from which you are getting the routine. If you are using the syntax of from <unit> import * you don't need to specify the unit name in the method calls.
See https://support.smartbear.com/testcomplete/docs/scripting/calling-routines/declared-in-another-unit/python.html
tristaanogre
8 years agoEsteemed Contributor
Unless my syntax is incorrect karthick7, USEUNIT is not supported for Python in TestComplete. I tried the following:
#[Unit1] def test1(): Log.Message('this is test 1') #[Unit2] #USEUNIT Unit1 def test2(): Unit1.test1()
I'm not really a Python guy, but as far as I can tell, USEUNIT won't work. You must use either of the two methods that I indicated in my earlier post
- karthick78 years agoContributor
tristaanogre Thanks For your information.
Related Content
- 10 months agolodecesa