HackerNews – Connect Everything with sharedVars.py

news, daily newspaper, press-1172463.jpg

When using a variable that we will call in many different files, we can put it all in a single file that will be called directly into other files. Creating a sharedVars.py is simple like so:

# region - For Postgres
user = None
password = None
dbname = None
host = None
port = None
engine = None
connection = None
sql_test = None

# endregion - For Postgres

# region - For Log Writing
file_name_for_log = None

# endregion - For Log Writing

Thus, if we are to initialize or call one of these variables, we will have to import this file import sharedVars as sv and then call it by using sv.user to access the user.