ValueError: Not enough samples to build a trace

Correct. All of that inside if __name__ == "__main__". No auxiliary functions.