spam!spam!spam!spam!spam!spam!spam!spamthe exec call has an effect similar to an importbut it doesn' actually import the module --by defaulteach time you call exec this way it runs the file' code anewas though you had pasted it in at the place where exec is called because of thatexec does not require module reloads after file changes--it skips the normal module import logic on the downsidebecause it works as if you've pasted code into the place where it is calledexeclike the from statement mentioned earlierhas the potential to silently overwrite variables you may currently be using for exampleour script py assigns to variable named if that name is also being used in the place where exec is calledthe name' value is replacedx exec(open('script py'read()same output 'spam!code run in this namespace by default its assignments can overwrite names here by contrastthe basic import statement runs the file only once per processand it makes the file separate module namespace so that its assignments will not change variables in your scope the price you pay for the namespace partitioning of modules is the need to reload after changes version skew notepython also includes an execfile('module py'built-in functionin addition to allowing the form exec(open('mod ule py'))which both automatically read the file' content both of these are equivalent to the exec(open('module py'read()formwhich is more complex but runs in both and unfortunatelyneither of these two simpler forms is available in xwhich means you must understand both files and their read methods to fully understand this technique today (this seems to be case of aesthetics trouncing practicality in xin factthe exec form in involves so much typing that the best advice may simply be not to do it-it' usually easier to launch files by typing system shell command lines or by using the idle menu options described in the next section for more on the file interfaces used by the exec formsee for more on exec and its cohortseval and compilesee and the idle user interface so farwe've seen how to run python code with the interactive promptsystem command linesunix-style scriptsicon clicksmodule importsand exec calls if you're looking for something bit more visualidle provides graphical user interface for the idle user interface