Why does simply importing a python module executes everything present in that module ? [duplicate]
问题 This question already has answers here : Why is Python running my module when I import it, and how do I stop it? (9 answers) Closed 5 years ago . Recently I noticed that using modules was a good option to keep my python programming tidy. For getting started, I made one module (named, oop.py) with a single class in it, which looks like below: #Module named oop class Team: def __init__(self): print "class Team initialized" def displayTeam(self): print "Team name: ", self.name, ",Rank :" , self