Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python NameError: global name 'multiprocessing' is not defined

I am trying to convert my threaded code to multiprocessing code. but it is giving me error

    Name Error: global name 'multiprocessing' is not defined

Multiprocessing is installed and I imported it by

    from multiprocessing import *
like image 947
Pratibha Avatar asked Oct 28 '25 05:10

Pratibha


1 Answers

With your import, you will import everything inside the multiprocessing module. I assume that you are making a call that looks something like

multiprocessing.some_function()

but since you've imported everything inside multiprocessing, it will not be in your namespace. I recommend that you do import multiprocessing and use that as your point of entry to not clutter your namespace.

like image 107
Maehler Avatar answered Oct 29 '25 18:10

Maehler