YOUR CODE ABOVE:
$thread->posts = $this->basicModel->getPostsByThread($thread->id);
shoud be only this
$thread->posts = $this->getPostsByThread($thread->id); // why need basicModel ?? if u can call direct
SECOND:
same, since instance is shared.
1) you need to get the instance first , $db = db_connect();
2) instance from parent class (model) , $this->db;