'NameError with extend_path using Bazel

I am trying to make a python program using bazel. When running the following snippet of code:

__path__ = __import__('pkgutil').extend_path(__path__, __name__)

I am given the following error:

NameError: name '__path__' is not defined



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source