Forum Discussion

sivakarthik's avatar
sivakarthik
Contributor
6 years ago

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

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    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.  

  • anupamchampati's avatar
    anupamchampati
    Frequent Contributor

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