Forum Discussion

ahughes's avatar
ahughes
Regular Visitor
9 years ago
Solved

Can't import files in Python

I'm simply trying to use an import statement to import some constants in a python test script and its not working. the file I'm trying to import is in my project and in the same directory as the file that's trying to import it. I've looked through the specifics of usage for Python and even copied the file into  <TestComplete>\Bin\Extensions\Python\Python34\Lib folder but still nothing. 

 

The specifics of usage also says you can "change the sys_path variable explicitly and then import the module" but Sys doesn't even have a "path" property.

  • Hi Ahughes,

     

    As far as I know, Evgeny from our TestComplete Customer Care Team has replied to your request with a possible solution. Please check if adding import sys to the script helps you import your *.py file.

     

2 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Ahughes,

     

    As far as I know, Evgeny from our TestComplete Customer Care Team has replied to your request with a possible solution. Please check if adding import sys to the script helps you import your *.py file.

     

  • Alexmak85's avatar
    Alexmak85
    Occasional Contributor
    sys.path.insert(0, r'C:\Program Files (x86)\SmartBear\TestComplete 12\Bin\Extensions\Python\Python36\Lib\site-packages\')