Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # File with my_func and global
- global_var = 0
- def my_func():
- global global_var
- global_var +=1
- # File with my_func no global
- def my_func():
- my_func.global_var +=1
- my_func.global_var = 0
- def other_func():
- #Can access the global
- print(my_func.global_var)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement