I was wondering if it's possible with my python script to install a module before trying to import it. When I run my script now it will try to import the modules (of course) but I want it to install the modules, then check if it can import it.
Update 1
This is my install script I wanna use to install it on run of script:
def install():
print("\nChecking for dependencies, please stand by...")
with hideInfo():
    if str(os.name) == 'nt':
        easy_install.main(['textract'])
        pip.main(['install', 'logging'])
        pip.main(['install', 'datetime'])
    else:
        pip.main(['install', 'textract'])
        pip.main(['install', 'logging'])
        pip.main(['install', 'datetime'])
time.sleep(1)
menu()
 
     
    