So I have two files: test.py and test2.py
Let's say I want to access the local variable of a function that belongs to another .py file, and have it display on the .py file I am working on. For example: I want my file test2.py to only display the variable three which belongs to the secondmain() function inside the program test.py Assuming that the variable three is a fixed local variable for test.py (meaning that making it global variable by putting it outside its function might break the code) ehat should I do to make it happen? Is it even a possibility?
test.py file:
import test2
def main(): <-- able to access
two = '2'
print("the letter " + two)
def secondmain():
three = '3' <-- wants to access
print("toying")
print("dancing")
print("testing")
print(main())
test2.py file:
import test
print('testing something')
test.main() # accessing the main() function of test.py
# accessing second main but wants to JUST access its variable three.
# test.secondmain().three???