Python module import issue after TestComplete upgrade – built-in objects not available
Hello Support Team,
We recently upgraded our TestComplete version, and after the upgrade we are facing a scripting issue with Python modules that was not present in the previous version.
Issue Description
We have multiple Python script units inside the same TestComplete project, for example:
- Unit1.py
- Unit2.py
Behavior in old version:
- Unit2 can be imported and called from Unit1 without any issues
- Log.Message() works correctly in both direct execution and when imported
Behavior after upgrade:
- Unit2 works correctly when executed directly
- However, when Unit2 is imported inside Unit1, execution fails with errors such as:
NameError: name 'Log' is not defined
In some cases, even:
NameError: name 'Project' is not defined
Sample Code
Unit2.py
def test(): Log.Message("Checking")
Unit1.py
import Unit2 def sample(): Unit2.test()
Expected Behavior
- Importing script units should not break TestComplete built-in objects like Log or Project
- Behavior should remain consistent with previous version
Actual Behavior
- Built-in TestComplete objects are not available during imported module execution
- Script fails only when a module is imported from another unit
Observations
- Unit2 works correctly when executed independently
- Issue occurs only during cross-module import
- Same scripts worked without modification in previous TestComplete version
Impact
This issue is affecting our existing automation framework which relies heavily on reusable Python modules across multiple script units.
Request
Could you please confirm:
- Whether this is a known behavioral change in the new TestComplete version?
- If there are any recommended changes for Python scripting modules after upgrade?
- Whether there is a supported way to ensure Log / Project objects remain available during module imports?
We would appreciate your guidance, as this impacts a large number of our existing automation scripts.
Thank you for your support.
Best regards,
VIshwanath