Import all members in a module : Module : Language Basics PYTHON examples


PYTHON examples » Language Basics » Module »

 

Import all members in a module



#//File: module1.py

def printer(x):           # module attribute
    print x


#//File: module2.py
print 'starting to load...'

import sys
name = 42

def func(): pass

class klass: pass

print 'done loading.'

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


from module1 import *             # copy out all variables
printer('Hello world!')

           
       



Leave a Comment / Note


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


PYTHON examples

 Navioo Language Basics
» Module