I have
# file1.py
global a, b, c, d, e, f, g
def useful1():
# a lot of things that uses a, b, c, d, e, f, g
def useful2():
useful1()
# a lot of things that uses a, b, c, d, e, f, g
def bonjour():
# a lot of things that uses a, b, c, d, e, f, g
useful2()
and
# main.py (main file)
import file1
# here I would like to set the value of a, b, c, d, e, f, g of file1 !
bonjour()
How to deal with all these global variables ?
PS : I don't want to add a, b, c, d, e, f, g for ALL functions, it would be very redundant to have to do :
def useful1(a, b, c, d, e, f, g):
...
def useful2(a, b, c, d, e, f, g):
...
def bonjour(a, b, c, d, e, f, g):
...
globalat the top-level of a file is an effectively useless statement.globalonly has meaning for identifiers inside a function...