I have many python files and sometimes I need to check them if they works. So they require different import ways in the file for libraries. The below code explains the situation.
I use else
situations for fles that import XLS
.
XLS.py
if __name__ == "__main__":
import config
else:
import DataLoaders.config as config
However I want to add dataset.py
file to if
situation.
if __name__ == "__main__" or __name__=="dataset.py":
import config
else:
import DataLoaders.config as config
I tried above code but it doesn't work. How to add the file name in if
to import config file as demanded?