ModuleNotFoundError: No module named '__app__'

Viewed 242

I get this unusual error when using the function multiprocessing in Azure function:

def multireader(par1, par2): 
        results = []
        jobs = []
        for i in range(5):
            p = multiprocessing.Process(target=myfunction, args=((par1, par2),))
            jobs.append(p)
            p.start()
async def main_(msg: func.ServiceBusMessage):
  multireader(par1, par2)

When I run process p.start(), I get this error:

Exception has occurred: ModuleNotFoundError       (note: full exception trace is shown but execution is paused at: <module>)
No module named '__app__'
  File "C:\Python38\Lib\multiprocessing\spawn.py", line 126, in _main
    self = reduction.pickle.load(from_parent)
  File "C:\Python38\Lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "<string>", line 1, in <module> (Current frame)

Does anyone have an idea how to solve this?

my files for script:

  • Main.py --> my function
  • Function.json
  • init.py --> empty
0 Answers
Related