A package pkg has two files, and the program main.py sits beside the package folder.
pkg/__init__.py:
order = ["pkg"]
pkg/tools.py:
from pkg import order
order.append("tools")
def name():
return __name__
main.py:
import pkg.tools
import pkg.tools
from pkg import tools
print(pkg.order, tools.name())
What does main.py print?
Log in to join the discussion.
Loading…