question

newuser-8aeb3f79-e874-4321-b35b-1323020dbfa9 avatar image

Unable to import module 'lambda_function': No module named 'add_directive'

Hi All! I am trying to run this code as suggested by a fellow amazon's employee.

from ask_sdk_model.interfaces.connections.send_request_directive import (SendRequestDirective)


        
if not (permissions and permissions.consent_token):
            logging.info("user hasn't granted reminder permissions")
            return (
                    rb
                    .add_directive(
                        SendRequestDirective(
                            name="AskFor",
                            payload={
                                "@type": "AskForPermissionsConsentRequest",
                                "@version": "1",
                                "permissionScope": "alexa::alerts:timers:skill:readwrite",
                            },
                            token=""
                        )
                    )
                    .response
                )

however, I am getting this error:


[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'add_directive' 
alexa skills kitapipythonrequesttimers-ao
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Gaetano@Amazon avatar image
Gaetano@Amazon answered

Hello and thanks for posting.

Are you using AWS lambda? Can you please share the entire folder layout?

Thanks,
Gaetano

10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.