Background The rapid transition from in-person to online delivery of medical curriculum has facilitated the continuation of medical education during the COVID-19 pandemic. Whilst active learning approaches, including Team-Based Learning (TBL), are generally more supportive of the learner’s needs during such transition, it remains elusive how different learning environments affect a learner’s motivation, engagement, and perceived learning over a prolonged period. We leveraged on the Self-Determination Theory (SDT) and key learners’ characteristics to explore the levels of student’s engagement and perceived learning in two TBL learning environments, online and in-person, over an extended period. We hypothesize that students’ self-reported perceptions of engagement and learning will be lower in online compared to in-person TBL classes. Methods This is a mixed methods study with 49 preclinical graduate medical students completing the same questionnaire twice for each learning environment, online TBL and in-person TBL, over an eight-month period. Quantitative data were collected on learners’ characteristics, basic psychological needs satisfaction, motivation, student’s engagement and perceived learning. Additionally, the final questionnaire also explored the participants’ perception on which learning environment better supported their learning. Results We found that autonomy support, perceived competence and needs satisfaction, and perceived learning were higher in-person than online. Additionally, most learners felt that in-person TBL was better for learning, as the concepts of learning space and the community of practice were mediated by being in-person. Conclusions TBL, being an active instructional method, can maintain students’ engagement because it supports many aspects of SDT constructs and perceived learning. However, online TBL is unable to fully support the students’ needs and perceived learning. Hence, we strongly advocate for any in-person opportunities to be included in a course, as in-person classes best support students’ engagement and perceived learning.