3 ms·
The directory containing the file is added to the path, and the named file is imported as the __main__ module. That's why "if __name__ == '__main__':" works in
by formerly_proven 5y ago
The directory containing the file is added to the path, and the named file is imported as the __main__ module. That's why "if __name__ == '__main__':" works in script files.
I don't think Python will resolve symlinks here, so if that needs to work, you probably need to do it yourself before touching other code / files.