Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def FunctionName(headings):
- for c in headings:
- exec('global %s' % c)
- <Other code...>
- import modulename
- headings = ['test1','test2','test3']
- modulename.FunctionName(headings)
- print(dir(modulename))
- print(modulename.test1)
- ['FunctionName',<Other function but no variables>]
- Traceback (most recent call last):
- File "<path>main_program.py", line 6,
- in <module>
- print(modulename.test1)
- AttributeError: module 'modulename' has no attribute 'nice'
- global <Var name>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement