The problem here is that the check script is not executing your pic function at the ./$1 statement. It is starting another process and running
pic which is a program to compile pictures for troff or TeX. However, if you execute sample in the same process it will work as you expect. Using . ./sample executes the contents of sample in the same process. Using ./sample starts another process to execute sample and the pic function is not available to that process. Here is the code I used to produce the desired result.
check script
Code:
#!/usr/bin/ksh
function pic
{
echo "Hello"
}
. ./$1
sample script
Note that I removed the typeset command. AFAIK functions cannot be exported like variables in ksh. They can be made available in memory using .profile or $FPATH along with the autoload feature of ksh. The only typeset options I have used with functions are -f -f
fname +f -ft +ft and -fu. Function names do take precedence over executables or scripts so take care in what you name them.
Bill