glomde wrote:
> Ok, now I think I know what I need to do.
> I need to create a variable in the calling functions locals.
> So how do I get access to the calles locals dictionary?
> Is it possible?
If your import is used in the current namespace, just use the global
keyword.
Best is if your funct
glomde wrote:
> I didnt mean that __import__ isnt a function, but that I want to
> make a function called ImoprtFile that actually does something
> very similar that what __import__.
>
> So to rephrsase the questin how does __import__ load a module
> into the callers namespace.
Ok got it now.
Ok, now I think I know what I need to do.
I need to create a variable in the calling functions locals.
So how do I get access to the calles locals dictionary?
Is it possible?
--
http://mail.python.org/mailman/listinfo/python-list
> I dont want the caller to call import but a function.
come again?
>>> type (__builtins__.__import__)
I didnt mean that __import__ isnt a function, but that I want to
make a function called ImoprtFile that actually does something
very similar that what __import__.
So to rephrsase the questi
glomde a écrit :
> Tanks but that isn't what I am looking for.
> I really want a function that you can call and imports
> the module into the calling functions namespace.
Please read the documentation of the __import__() *function*. (notice
the double leading and ending underscores and the parent
glomde wrote:
> Tanks but that isn't what I am looking for.
> I really want a function that you can call and imports
> the module into the calling functions namespace.
>
> I dont want the caller to call import but a function.
come again?
>>> type (__builtins__.__import__)
--
Edward Elliott
Tanks but that isn't what I am looking for.
I really want a function that you can call and imports
the module into the calling functions namespace.
I dont want the caller to call import but a function.
--
http://mail.python.org/mailman/listinfo/python-list
glomde wrote:
> Hi,
>
> I want to create a function that preprocesses a file and then imports
> the parsed file.
>
> What I found out is that you can do something like this:
>
> def ImportFile(fileName):
> parsedCode = Parser(fileName).Parse()
> module = new.module(name)
> exec parse