The pipeline in your "while" loop runs in separate subshells. Since the do_it function is not exported, the child subshell on the right that runs entr does not know about it. The shortest solution would be to export the function (bash allows this).
do_it(){ echo Eita!; }
export -f do_it
while true; do ls folder/* more-folder/* | entr -pd do_it; done
If the entr command wants to execute something from disk, then I would suggest putting the function in a script file, then point entr to that.
file named /path/to/do_it
#!/bin/sh
echo Eita!
ensure the file is executable:
chmod +x /path/to/do_it
new commandline:
while true; do ls folder/* more-folder/* | entr -pd /path/to/do_it; done