Hi Murphy, others,

It's my understanding (from the wiki, etc) that POX is designed to be launched from the command line only, with options given to individual components on the command line as well. The wiki recommends that if you have multiple components and this is getting unwieldy to create a base module which launches them all - this is how I currently start POX.

What I would like to do is pass callbacks to the launch function of each of the individual components. This is my current method:

1) Possible functions are stored in individual modules each containing a function called "callback" (say)

2) From an external-to-POX python script (something like a configuration script), I specify the callback function I want as a string ("mypackage.function1")

3) I start POX as a separate subprocess, with the string as a component argument ("pox.py base_component --callback=mypackage.function1")

4) In the launch function for base_component, I dynamically import mypackage.function1 and store the callback() function from it - and use it from there as required

...which is a strange and awkward process to say the least. In my perfect world I'd be able to start POX, from within my python script, and directly pass these functions (and potentially other python objects, to keep this general - essentially all I want is to avoid the conversion to command line args) to my POX components.

Not sure what I'm expecting to get out of this email but maybe just suggestions? Ideas? Am I doing this a very stupid way and there's a simple solution available right now? More than happy to play with the POX code - I had a look at pox.boot, briefly, but it seemed quite focused on the argv idea so would require a bit of work. Maybe something like the boot function that took, say, a python dict of args?

Would appreciate any comments you might have.

-- Kim

Reply via email to