Ha ha of course, otherwise it wouldn’t be fun 
I’m wondering if it’s not because of the context manager: try to return bayesian_model in fit, and then:
def main():
df = pd.read_csv("df3.csv")
bayesian_model = fit(df, time_column="T", event_column="c")
with bayesian_model:
trace = pm.sample(target_accept=0.9, draws=draws, tune=tune, random_seed=123, return_inferencedata=True)
return trace
If this still doesn’t work, try returning the model from fit and then from main and putting the context manager and sample under the if __name__ == "__main__" clause.
You can also try running the model raw, without the custom python functions to test that it does sample and that the problem comes from the function definitions themselves.
Hope this helps 