最佳答案
My code is:
import scriptlib.abc
import scriptlib.xyz
def foo():
... some operations
but the scriptlib is in some other directory, so I will have to include that directory in environment variable "PYTHONPATH".
Is there anyway in which I can first add the scriptlib directory in environment variable "PYTHONPATH" before import statement getting executed like :
import sys
sys.path.append('/mypath/scriptlib')
import scriptlib.abc
import scriptlib.xyz
def foo():
... some operations
If so, is the value only for that command prompt or is it global ?
Thanks in advance