Pymc3 repeating the whole script while sampling

My question is similar to this one,Sample runtimeerror when cores>1
The whole script is run again and again when sampling is performed using pymc3.
The difference is I am using somebody’s programs which are a lot more complicated. The different programs constitute a software.

I write a simple script to execute the software.

dep =software.project(a=0.14, b=0.12)
dep.multiprocess()

First, “dep” object is created and then passed into “multiprocess” which uses pymc3.
The program which uses pymc3 has got different functions. One of the functions has pymc3.

def name_of_function():
       (unimportant lines omitted)
        with basic_model:
            tm = pm.find_MAP()
            trace = pm.sample(nmcmc, tune=tune, start=tm)
       print('Done.')

So, when “trace = pm.sample(nmcmc, tune=tune, start=tm)” is being performed, the whole script is run again from the beginning.

There are several classes in this program.The one that the function belongs to is something like this. There is no main() function

class name_of_class(object):
         def __init__(self,a=None,b=None):
                  self.a = a
                  self.b = b

I don’t know where to add name == ‘main’, or whether it can be added to the program at all.

Problem solved. Now I understand how to add main. Previously I made it too complicated.