lundi 15 avril 2019

how to import modules in python

I'm making a lambda function in python. Here is the current structure of my project.

lambda/
|-- package_name/
|   |-- __init__.py
|   |-- lambda_function.py
|   |-- a.py 
|   |-- utils.py
|
|-- tests/
|   |-- __init__.py
|   |-- test_main.py
|-- setup.py
|-- README

I would like to import lambda_function.py and a.py in test_main.py

I tried

from a import *
import a

and some others, but nothing is working.

Could you explain me what is the right solution, and why what I tried actually deosn't work ?

Aucun commentaire:

Enregistrer un commentaire