Customizing module globals
Kerim Borchaev ( WarKiD )
warkid at storm.ru
Fri Sep 7 03:48:24 EDT 2001
Thursday, September 06, 2001, 11:11:43 PM, Terry Reedy answered my
question:
>> Can I specify what module's to be imported symbol table will be?
>>
>> Say I have a module named Module that assumes that there's an object
>> Object without implicit declaration like this :
>>
>> Module.py
>> ----------------
>> Object.doThings()
>> ----------------
>>
>> And I can import/run this module with specific a Object?
TR> You can set module attributes in the obvious manner.
TR> import module
TR> module.Object = <some object>
But te problem is that import fails...
File "ModuleUser.py", line 1, in ?
import Module
File "Module.py", line 1, in ?
Object.doThings()
NameError: name 'Object' is not defined
Best regards,
Kerim mailto:warkid at storm.ru
More information about the Python-list
mailing list