I am starting with Python. Before you begin, here is my Python folder structure
-project ----src ------model --------order.py ------hello-world.py
In src , I have a folder called model that has a Python file called order.py whose contents are as follows:
class SellOrder(object): def __init__(self,genericName,brandName): self.genericName = genericName self.brandName = brandName
Next, my hello-world.py is inside the src folder, one level above order.py :
import model.order.SellOrder order = SellOrder("Test","Test") print order.brandName
Whenever I run python hello-world.py , this results in an error
Traceback (most recent call last): File "hello-world.py", line 1, in <module> import model.order.SellOrder ImportError: No module named model.order.SellOrder
Is there something I missed?
python module
user962206
source share