Cannot use function in custom mix task defined in same app

No other ideas. You should try to make a small project reproducing the issue and put it on GitHub so we can try our hand at it.