Change current process environment's LD_LIBRARY_PATH
Is it possible to change environment variables of current process? More specifically in a python script I want to change LD_LIBRARY_PATH so that on import of a module 'x' which depends on some xyz.so , xyz.so is taken from my given path in LD_LIBRARY_PATH is there any other way to dynamically change path from where library is loaded? Edit : I think I need to mention that I have already tried thing like os.environ["LD_LIBRARY_PATH"] = mypath os.putenv('LD_LIBRARY_PATH', mypath) but these modify the env. for spawned sub-process, not the current process, and module loading doesn't consider the