Error happens in model after modifying PyMC3 source code

When I am debugging a model, it would be very useful to modify the source code to print or return some intermediate variables for checking.
However, it seems some error will happen after PyMC3 reloads the source code, even by just merely adding a print statement. Thus currently I need to restart Python every time I change the source code.
It seems PyMC3 compiles the code when it builds a model?

May I ask any insight about this strange behavior?
Or is there any better approach to debugging the source code. This would be quite helpful to help make contribution to the code base as well.

For example, if I change the source file pymc3/distributions/multivariate.py:MvNormal, after reloading the new source code, it gives out such an error when I try to create a new RV.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-c8e5b0e59f8e> in <module>()
      3 with model:
      4     name = 'f_pred17'
----> 5     f_pred = gp.conditional(name, Xnew=ts[:,None])
      6     samp = pm.distributions.distribution.draw_values([f_pred], point=p, size=1)

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pymc3/gp/gp.py in conditional(self, name, Xnew, pred_noise, given, **kwargs)
    477         .. math::
    478 
--> 479            f_* \mid f, X, X_* \sim \mathcal{GP}\left(
    480                K(X_*, X) [K(X, X) + K_{n}(X, X)]^{-1} f \,,
    481                K(X_*, X_*) - K(X_*, X) [K(X, X) + K_{n}(X, X)]^{-1} K(X, X_*) \right)

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pymc3/distributions/distribution.py in __new__(cls, name, *args, **kwargs)
     39                 raise TypeError("observed needs to be data but got: {}".format(type(data)))
     40             total_size = kwargs.pop('total_size', None)
---> 41             dist = cls.dist(*args, **kwargs)
     42             return model.Var(name, dist, data, total_size)
     43         else:

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pymc3/distributions/distribution.py in dist(cls, *args, **kwargs)
     50     def dist(cls, *args, **kwargs):
     51         dist = object.__new__(cls)
---> 52         dist.__init__(*args, **kwargs)
     53         return dist
     54 

~/.pyenv/versions/anaconda3-5.2.0/lib/python3.6/site-packages/pymc3/distributions/multivariate.py in __init__(self, mu, cov, tau, chol, lower, *args, **kwargs)
    221     def __init__(self, mu, cov=None, tau=None, chol=None, lower=True,
    222                  *args, **kwargs):
--> 223         super(MvNormal, self).__init__(mu=mu, cov=cov, tau=tau, chol=chol,
    224                                        lower=lower, *args, **kwargs)
    225         self.mean = self.median = self.mode = self.mu = self.mu

TypeError: super(type, obj): obj must be an instance or subtype of type

BTW, I use Jupyter notebook to run the code, and reload the source code by running the following on the top of the notebook.

%load_ext autoreload
%autoreload 2

You really should not modify source code for model debugging. For debugging pymc3 model you can have a look at: https://docs.pymc.io/notebooks/howto_debugging.html

Thanks Junpeng.
I read that once, but it is not very helpful to my problem at hand. So I prefer to backup the PyMC3 source code (at the worse case I can still reinstall the whole package) and modify it, during which I also learn quite a bit.