A module greet.py and a program main.py sit in the same folder. You run main.py.
greet.py:
def hello():
return "hi from " + __name__
if __name__ == "__main__":
print("run directly")
main.py:
import greet
print(greet.hello(), __name__)
What does main.py print?
Log in to join the discussion.
Loading…