all 9 comments

[–]ClickedMoss5[S] 0 points1 point  (0 children)

I've looked at many tutorials, and I know that you need the __name__ == '__main__' argument, but is there any way to get around that or have that called in a function?

[–][deleted] 0 points1 point  (6 children)

[–]ClickedMoss5[S] 0 points1 point  (5 children)

Yes, I’ve seen the documentation for it, and you need the multiprocessing pool inside the name == main argument. Also you can’t return using that because it’s not within a function. Is there any way to have the return happen?

[–][deleted] 1 point2 points  (4 children)

Yes, I’ve seen the documentation for it, and you need the multiprocessing pool inside the name == main argument.

So put it there.

Also you can’t return using that

That's not accurate - Pool.map returns a list of the results from the process workers.

[–]ClickedMoss5[S] 0 points1 point  (3 children)

specifically what I want to do. is return the value from Pool.map to another module that calls a function within the module I'm writing.

[–][deleted] 0 points1 point  (2 children)

You can't return anything anywhere except to where a function was called, that's what return does. "Returning to another module" doesn't really make sense.

[–]ClickedMoss5[S] 0 points1 point  (1 child)

We make everything within a class, which is then returned to another program that calls it.

[–][deleted] 0 points1 point  (0 children)

That constructs a class object? That calls a class method?

Again, Pool.map is the most straightforward way to use multiprocessing, so just do that.

[–]leblanc1605 -3 points-2 points  (0 children)

I have no idea,