I have a module named `multi.py`. If I simply wanted to execute multi.py as a script, then the workaround to avoid crashing on Windows (spawning an infinite number of processes) is to put the multiprocessing code under:

```
if __name__ == '__main__':

```

However, I am trying to import it as a module from another script and call `multi.start()`. How can this be accomplished?

```
# multi.py
import multiprocessing

def test(x):
    x**=2

def start():
    pool = multiprocessing.Pool(processes=multiprocessing.cpu_count()-2)
    pool.map(test, (i for i in range(1000*1000)))
    pool.terminate()
    print('done.')

if __name__ == '__main__':
    print('runs as a script,',__name__)
else:
    print('runs as imported module,',__name__)

```

This is my `test.py` I run:

```
# test.py
import multi
multi.start()

```