some import / namespace questions

stef mientki s.mientki at
Thu Aug 9 01:49:18 CEST 2007

Marc 'BlackJack' Rintsch wrote:
> On Wed, 08 Aug 2007 17:11:19 +0200, stef mientki wrote:
>> Now it's not possible to import in the existing modules the main plugin, 
>> like
>>    from Main_User import *
>> because this will start the infinite loop.
> Which means there's code at the module level. 
>  Tell the users to put that
> into a function, then you can import the module without executing this
> main loop.
ok, I'll do that for the user (the user writes in another language),
and indeed it works,
but has one disadavantage ... see below
> And don't do a * import because your users might use names that the
> importing module uses already and which would get replaced by the * import.
Yes that's a principal problem with this program, for which I've no 
(simple) solution.
I'm simulating a microprocessor language here, where "globality"  is an 
essential part of the language.
So I'll have to stick to import *, (although I'm aware it's not a good 
programming method, especially in user plug-ins)
and now the problem is that I get a warning that import * is only 
allowed at the module level :-(
But despite the warning it's still working. ;-)

Stef Mientki

More information about the Python-list mailing list