I am working on an inventory system for a game I am working on, I've wrote these blocks of code for the system so far. I want the system to work without the use of global functions because I've read that you should avoid using global functions.
while not done:
    global inventory
    pygame.mouse.set_visible(False)
    #Event processing
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            done = True
    elif event.type == pygame.KEYDOWN:
        if event.key == pygame.K_i:
             inv_sys.inventory = True
             inv_sys.inventory_u()
import pygame
import Constants
clock = pygame.time.Clock()
screen = pygame.display.set_mode(Constants.screen_size)
inv = pygame.image.load("inv.png").convert()
test = False
def uninventory():
    global inventory
    inventory = False
def inventory_u():
    while inventory:
        pygame.mouse.set_visible(True)
        screen.blit(inv,(0,0))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit
            elif event.type == pygame.KEYDOWN:    
                if event.key == pygame.K_i:
                     uninventory()
         pygame.display.update()
         clock.tick(60)
thank you ahead of time for any help!
 
     
     
     
    