cancel
Showing results for 
Search instead for 
Did you mean: 

getting error while import a function from another python script

Contributor

getting error while import a function from another python script

Hello Everyone,

 

as you can see in below code, I have created two modules and I am importing a fuction from first script.

But testcomplete is giving this error

"ImportError: cannot import name 'func1' ". 

I don't understand why it's giving this error. Did any one have idea regarding this issue if so please let me know it will be help full for me

Thanks and regards

SivaKartheek Sreeram

code:

#Script1 named as script1.py
def func1(parameter):
...........
.........
   return variables
# Script 2 named as script2.py

from script1 import func1

def func():
   func1(x)
   ................................
......................................
2 REPLIES 2
Highlighted
Community Hero

Re: getting error while import a function from another python script

That's really not much to go on.  Let's see your actual code.  The more details you give us all at once, the easier it is for us to help you.  We can't guess the problem.  

Contributor

Re: getting error while import a function from another python script

Check whether you are using any variable with the same name  of function.