I wanted to import a variable defined in function to another python file
e1.py
def abc():
global a
a=10
e2.py
import e1
def defi():
c=e1.abc.a
print(c)
defi()
I have searched but didn't get the right answer
Following is the error-
Traceback (most recent call last):
File "C:\Users\gkaur\Documents\MSO Editor Tool\e2.py", line 1, in <module>
from e1 import abc
File "C:\Users\gkaur\Documents\MSO Editor Tool\e1.py", line 2
global a
SyntaxError: name 'a' is parameter and global
abc()because this is aruntimesetting.print abut it still gives an errore1shown. Are these files named "e1.py" and and "e2.py" or "file1.py"and "file2.py"? Also,abchas no attribute named "a".