Export import with __all__



examples/modules/my_module2.py
__all__ = ['a', '_c']

def a():
    return "in a"

b = "value of b"

def _c():
    return "in _c"

def d():
    return "in d"

examples/modules/z.py
from my_module2 import *

print(a())     # in a
print(_c())    # in _c

print(b)

# Traceback (most recent call last):
#   File ".../examples/modules/z.py", line 7, in <module>
#     print(b)       # value of b
# NameError: name 'b' is not defined