I have two (2) scripts as follows:
test.py
from google.apputils import app
import gflags
FLAGS = gflags.FLAGS
gflags.DEFINE_string('flag1', 'Value 1', 'flag#1')
def main(argv):
FLAGS.flag1 = "Value2"
print 'Flag 1 has value: ' + FLAGS.flag1
if __name__ == '__main__':
app.run()
and test1.py
from google.apputils import app
import test
def main(argv):
print 'Flag 1 has value: ' + test.FLAGS.flag1
if __name__ == '__main__':
app.run()
How I can pass changed flag value from test.py to test1.py so I have output "Flag 1 has value: Value2" in test1.py?
I have found the solution as follows:
test.py
and test1.py