Set up a global variable I can use throughout my package

I am trying to set a global variable I can use inside my whole package, but there's something I don't understand and I didn't find a similar question.

Here is the content of config.py

var = 1

Here is the content of a.py

from config import var

def function1():
    global var 
    print(var)
    var = 2

Here is the content of b.py

from a import function1
from config import var

function1()

def function2():
    global var
    print(var)

function2()

This is probably very silly, but I would be interested to have output 1 and 2, but both functions, i.e. function1() and function2(), give me output 1

How can I set a variable I can use throughout my package? Is it a good practice?