How to return to my main program from an imported function in python?
Question: I'm trying to go back to my main program from an imported function. My
situation is something like this:

    
    
    main program
         ||
         \/
    imported function
         ||
         \/
    imported function (2)
    

now I want to go back from the second imported function to the main program.

    
    
    main program  <=========\\
         ||                 ||
         \/                 ||
    imported function       ||
         ||                 ||
         \/                 ||
    imported function (2) ==//
    

my program looks like this:

    
    
    import pygame, sys
    from pygame import*
    def main():
        while True:
            events = pygame.event.get()
            for event in events:
                if event.type == pygame.MOUSEBUTTONUP:
                    import function
    

my function looks like this:

    
    
    print('something')
    #do stuff
    import function2
    

my second function is almost the same:

    
    
    print('something')
    #do stuff
    '''
    now I want to go back to the main program
    '''
    


Answer: I'm guessing that u mean your are calling a function in your main program that
is from your imported code, the subroutine will carry out and then your code
in the main program will continue running for example if i import the time
libary then call a function for example,

    
    
    var = datetime.datetime.today().weekday()
    

That will return an integer that will represent the day of the week and then
the code after that in the main program where i have called the time
subroutine will carry on running. To get more imported functions just call
them(first time answering a question so sorry in advance).

