I have two files File1 and File2. In File1 I have a function detect() defined as:
def detect():
s = // some operations
I need to access this variable s in File2.
I have tried declaring the variable as global but it has not worked.
How can I access the variable without creating a class as in this post or by using __main__ as in this post ??
detect()function return the variable?sdoesn't have a value untildetect()is actually evaluated, so what you're asking for doesn't make sense.