Module-level variable is defined at the top level of a module. Global variable is declared with global inside a function.
Module-level:
1# module.py2count = 0 # Module-level34def increment():5 global count6 count += 1
Global in function:
1def func():2 global x3 x = 10 # Creates global variable45func()6print(x) # 10
Best practice: