calling python procedures from tcl using tclpython

Jeff Hobbs jeffh at
Sat Jul 9 01:56:46 CEST 2005

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.

   Jeff Hobbs, The Tcl Guy, a division of Sophos

More information about the Python-list mailing list