When debugging, the most important point is to quickly understand which lines of code might interfere. With increasingly large projects, this is tedious.
A mayor part of this could be automatized by creating a copy of the larger project where every lines that is not executed in the specific test case is commented out (or only lines are copied that are really executed). Is there a trick to do this in Python?
Sounds like you are looking for something like code coverage
This is a cli based tool in python - https://coverage.readthedocs.io/en/v4.5.x/
Coverage.py is a tool for measuring code coverage of Python programs. It monitors your program, noting which parts of the code have been executed, then analyzes the source to identify code that could have been executed but was not