Marco Aschwanden schrieb:
> Marvelous that was the solution I was looking for.
>
>> I think you should consider a class instead of a module, though.
>
> What I don't get: Why should I consider using a class?
Because sharing state in such a way that several functions need to
access some later bo
Marco Aschwanden wrote:
> Load a module and hand in already the server_api. How can I achieve this?
use execfile (or compile/exec) instead of import.
--
http://mail.python.org/mailman/listinfo/python-list
Marvelous that was the solution I was looking for.
> I think you should consider a class instead of a module, though.
What I don't get: Why should I consider using a class?
Greetings from sunny Switzerland,
Marco
--
http://mail.python.org/mailman/listinfo/python-list
Marco Aschwanden wrote:
> Load a module and hand in already the server_api. How can I achieve this?
Using execfile() is the simplest approach:
import imp
import sys
def import_preloaded(name, path=None, variables={}):
if path is None:
file, path, description = imp.find_module(name)
Hi
I have a script that looks for modules and tries to load them. After
loading I attach the "server"-API function to it.
module = __import__(module_name, globals(), locals(), [])
module.server = server.server_api
Now, some modules need the "server" functionality on load/init. I tried to
mo