Jeff Hobbs wrote: > chand wrote: > > can anyone help me how to provide the info about the python file > > procedure in the tcl script which uses tclpython i.e., is there a way > > to import that .py file procedure in the tcl script > > >>>currently I have wriiten this tcl code which is not working > >>> > >>>package require tclpython > >>>set interpreter [python::interp new] > >>>$interpreter eval {def test_function(): arg1,arg2} ; > >>>python::interp delete $interpreter > > You would call 'import' in the python interpreter, like so: > $interpreter eval { import testfile } > assuming it's on the module search path. Look in the python > docs about Modules to get all the info you need.
Actually, both your import and the original "def" problem need to use exec instead of eval. Eval works with expressions; for statements you need exec. I blogged a brief example of tclpython over here: http://spyced.blogspot.com/2005/06/tale-of-wiki-diff-implementation.html -Jonathan -- http://mail.python.org/mailman/listinfo/python-list