How to close and open a import module like a reboot

  python-3.x

I am trying to make my updater able to reboot so I can update without stopping the program, here is my code, and it doesn’t work, anyone know how to make it work?

import versionLoader
import os

cwd = os.getcwd()
cwdKeep = cwd

def reboot():
    os.chdir(cwdKeep)
    versionLoader.exit()
    import versionLoader

Source: Python-3x Questions

LEAVE A COMMENT