Ask a Question

getting error while import a function from another python script

sivakarthik
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
Marsha_R
Community Hero

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.  


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
anupamchampati
Frequent Contributor

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

cancel
Showing results for 
Search instead for 
Did you mean: