Attempt to index local 'self' in function

My code is spitting out an error and I have no idea why. If I copy paste the first two lines of my HostilesVisible into RunBehavior() it runs fine. In a separate function however, it blows up. Any ideas?

[lua]function ENT:RunBehaviour()
while ( true ) do

	if self.HostilesVisible() then
		self.loco:FaceTowards( self.Enemy:GetPos() )
	end
	
    coroutine.yield()
end

end

function ENT:HostilesVisible()

local dir = (self.Enemy:GetPos() - ENT:GetPos()):GetNormal(); -- replace with eyepos if you want
local canSee = dir:Dot( ENT:GetForward() ) > 0.8; -- -1 is directly opposite, 1 is self:GetForward(), 0 is orthogonal

--local att = "Bip01_Head1"

– local headpos = self:GetAttachment(self:LookupAttachment(att))

if (canSee) then
	return true
else
	return false
end

end[/lua]

You’re using a “.” not a “:”, so it should be, “self:HostilesVisible()”