Hi, I appreciate all replies to my previous quesions. This time, I am trying to pass two parameter to eval function so it can evaluate and return the result base on the parameter i gave. For examples:
********func.py*************** def fun (): print v1+v2
**************pro.py*********** from func import * funname = "fun()" v1 = "Hello " v2 = "World" eval(funname) **************************** I know these code will not run. If i put fun in the same file as pro.py, it works. What i want is to let fun in func.py to have access to variable v1 and v2 which are declared in pro.py. How can i do this? Any guidance or suggestion is highly appreciated.
I know this construct is weird. The reason i do this is the following: I have a cgi page that maintain the step to perform based on the form fields it receives. There are many fields this main cgi will receive. But each page pointing to this main page may send different set of fields. So base on the fields main cgi page get, it can determine which page to run next. My plan is to get the name of the function and pass it to eval. But that particular function passed to eval will use some parameters received by main page. That is why i wish to make all the variables in main page to be visible by other functions so i don't have to worry what parameters to be passed. Any good alternative to this problem? Thanks a lot. Kim Titu __________________________________________________ Do You Yahoo!? Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. http://im.yahoo.com