import packagename
path = packagename.__path__[0]
Errors with:
3:8 - error: "__getitem__" method not defined on type "Iterable[str]" (reportGeneralTypeIssues)
However:
$ python
Python 3.6.9 (default, Nov 30 2019, 18:11:51)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import packagename
>>> type(packagename.__path__)
<class 'list'>
>>>
pyright 1.1.70
Thanks for the bug report. The fix will be in the next release.
This is addressed in Pyright 1.1.72, which I just published. It will also be in the next release of Pylance.