'Unable to import variables from Lambda function to another .py file

I have created a lambda function which has below structure:

 **MyTestLambdafunction**
      -TestCases
        -mytestcase.py (This file is inside TestCases package)
      -lambdafunction.py
    
   **lambdafunction.py** (the urls are coming from SQS service)
    global url
    lambda_handler(event,context):
        url=code_to_fetch_url_from_sqs
        print(url)
    
   **mytestcase.py**
      from lambdafunction.py import *
      
      class Test:
       def mytestcase:
          myurl=url 
          print(myurl)

Issue I'm facing is I am able to get and print url correctly in lambdafunction.py file but I m not able to get the url from lambdafunction.py to mytestcase.py file. I have tried all sorts of import statements such as - from lambdafunction.py import * but it isn't getting the url.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source