def is_main_process():
 return (multiprocessing.current_process().name == 'MainProcess')

def is_main_process ( ) : return ( multiprocessing . current_process ( ) . name == 'MainProcess' )
good for wrapping some code sections which you dont want to run during the import of a sub-process .