How to share global variables between python files

In Python, it is better to use a single module to hold all the global variables you want to use and whenever you want to use them, just import this module, and then you can modify that and it will be visible in other modules that do the same.

Create a Global module

#global.py
current_value=0

Create a Python program file to access global variable

#updater.py
import global
def update_value():
global.current_value = 100

Create another Python program to test value is changed or not

#display_value.py
import global
import updater
updater.update_value()
print(global.current_value)