Forum Discussion
The latest version of TestComplete comes with Python 3.13. Python has made a number of changes. One of them is treating global as regular scoped objects, which has impacted Python scripts used in TestComplete.
See https://support.smartbear.com/testcomplete/docs/scripting/specifics/python_tc_globalobjects.html for more information. You need to update your Python scripts to accommodate this change.
As an example, Log is being passed as a parameter -
MainTest.py
import MyFunctions
def main():
MyFunctions.greet(Log, "Alice")
MyFunctions.py
def greet(Log, name):
Log.Message(f"Hello, {name}!")
Same issue has been discussed here,
TestComplete 15.77 is broken - dont upgrade | SmartBear Community
- Xavi2 days agoOccasional Contributor
The solution to pass the objects as parameters, works.
But for a big project, it means a lot of work to change too much source code.
My big doubt is why the 2 alternatives options in this link (tc module and global import file), don't works in some cases ?
Working with TestComplete Global Objects in Python 3.13 | TestComplete Documentation
Thanks,
- rraghvani2 days ago
Champion Level 3
Remove "tc" from "tc.Aliases.Client". Try this for example,
Unit1.py
import Unit2 def main(): Unit2.datetime()Unit2.py
from tc import aqDateTime # or from tc import * def datetime(): return aqDateTime.Now()If you have a big project, it is a pain to update. However, there's no way around this, as Python have made these changes.
- mcpm2 days agoOccasional Contributor
I had a similar issue to yours, and our project is too big to pass these keywords to the function, but using "from tc import Log, Aliases" works for me. However, I came across another issue:
https://community.smartbear.com/discussions/testcomplete-questions/logging-issue-on-tc-15-80-python-scripts/279683
- Xavi2 days agoOccasional Contributor
I tried, but I don't know why the easiest solution as "from tc import *" or "from tc import Aliases", don't works:
Thanks,