Python middleware initialisation fails with multiple files

I’m trying to use a Python plugin which is divided across several files.

It works fine when there is only one file in the manifest.json. However, when a second file is added, initialisation fails with:

“Middleware initialization error: [Errno 2] No such file or directory: ‘/middleware.py’”.

The bundle has been downloaded and unpacked correctly, and both files are present at:

/opt/tyk-gateway/middleware/bundles/[guid]

I suspect this may be related to 2.7.0 downloaded middleware bundles "no such file or directory" · Issue #1839 · TykTechnologies/tyk · GitHub, which describes a similar bug for JSVM.

Reviewing the source code here:

it seems that this is a bug; that code will always set the path to /middleware.py, as starting with the / creates an absolute path.