How to import specific parts from libs?

utils.py

# Only import say_hello and say_bye when import *
__all__ = ["say_hello", "say_bye"]

def say_hello():
    print("hello")

def say_bye():
    print("Bye")

a=2

Code.py

from utils import *
say_hello()
say_bye()
print(a)

Leave a Reply