Fetches an already-loaded module : Module : Language Basics PYTHON examples


PYTHON examples » Language Basics » Module »

 

Fetches an already-loaded module



#//simple.py

print 'hello'
spam = 1                   

#///////////////////////////////////////////////////////////////////////////
#//Main.py

import simple          # first import: loads and runs file's code

print simple.spam            # assignment makes an attribute

simple.spam = 2        # change attribute in module

import simple          # just fetches already-loaded module
print simple.spam            # code wasn't rerun: attribute unchanged



           
       



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Language Basics
» Module