I have a Python script, say pyscr.py. Let's say this file defines the following function:
def f1() :
print ('python func executing')
How do I call this function f1 from a Tcl script?
You need to write a Tcl script to define a procedure to execute a Python script, and then call the procedure. Try this:
#! /usr/bin/tclsh
proc call_python {} {
set output [exec python pyscr.py]
puts $output
}
call_python
f1 from tcl scriptcan't find package tclpython. I tried to install tclpython as apt-get install tclpython , but this says can not find package tclpython
set python_output [exec python -c {import "pyscr.py"; f1}]