Nov-11-2022, 09:20 PM
Hi Team,
how to manage variables which can be used in project level, instead of passing all variables from main def
In my project I am using total 10 modules. [no class module used]
in main function I have created all variables.
few functions are calling in same module, and passing 80% job to another module. main2 to finish.
from main_function I am passing all variables to main2 function which is in another module
and importing all functions from other module into main2 module.
and doing jobs.
how to manage variables which can be used in project level, instead of passing all variables from main def
In my project I am using total 10 modules. [no class module used]
in main function I have created all variables.
few functions are calling in same module, and passing 80% job to another module. main2 to finish.
from main_function I am passing all variables to main2 function which is in another module
and importing all functions from other module into main2 module.
and doing jobs.
import sys import json def main(): var1 = sys.argv[1] var2 = sys.argv[2] var3 = sys.argv[3] var4 = sys.argv[4] var5 = sys.argv[5] with open("DBConfig.json","r") as myconfig: obj = json.loads(myconfig) server = obj[1] database = obj[2] constant_path = obj[3] logging_path = obj[4] hd ,conn = connect_database(server,database) hd, conn = connect_SP(server, database,logger) #function call with main2(var1,var2,var3,var4,var5,var6,server,database,constant_path,conn,logging_path) pass if "___name__ " == "__main__": main()