Python module dependencies
Question: I'm trying to make my own module for easy sprite rendering & creation for
personal uses. The only problem is, it needs pygame. If I were to put `import
pygame` at the top of my module, could I then in another program, setup pygame
instead of setting it up in the module? In general, does importing modules in
one program, then importing that program into your main module, does the main
program inherit the same dependencies, or do you need to explicitly re-import
them?

Module to be used:

    
    
    import pygame
    def makeSprite():
        # todo write code INCLUDING PYGAME DEPENDENCIES
        pass
    def updateSprite():
        # todo write code INCLUDING PYGAME DEPENDENCIES
        pass
    

Program using module:

    
    
    import myModule  # myModule is the name of the module above
    pygame.init()
    makeSprite(arg1, arg2)
    updateSprite(arg1, arg2)
    pygame.functionCallFromPygame()
    

Can the main program also use the module? Thank you.


Answer: That shouldn't be a problem. As long as nothing tries to actually use pygame
functionality before `pygame.init()` is called, it'll work fine.

(In other words, as long as whatever program using your library calls
`pygame.init()` before calling your library's functions, you'll be fine.)

