5.4. Variable scoping in subsidiary files

When a subsidiary configuration file is read, it is given its own namespace; it does not have automatic access to variables from the parent configuration file.

Any variables (not just SCons objects) that are to be shared between configuration files must be explicitly passed in the SConscript call using the Export method:

	env = Environment()
	debug = Environment(CCFLAGS = '-g')
	installdir = '/usr/bin'
	SConscript('src/SConscript', Export(env=env, debug=debug, installdir=installdir))
	

Which may be specified explicitly using a keyword argument:

	env = Environment()
	debug = Environment(CCFLAGS = '-g')
	installdir = '/usr/bin'
	SConscript(sconscript = 'src/SConscript',
	           export = Export(env=env, debug=debug, installdir=installdir))
	

Explicit variable-passing provides control over exactly what is available to a subsidiary file, and avoids unintended side effects of changes in one configuration file affecting other far-removed configuration files (a very hard-to-debug class of build problem).