Reputation: 453
I'm new with python and I'm trying to import one module for using some functions but I'm having issues with it. This is my directory:
This is my source path:
/home/adrian/eclipse-workspace/Desarrollos/desarollos_backend_HLC_filters/website_base_filter_2/controllers/generic_functions.py
This is my class inside the file.
class CustomerPortalFilters(CustomerPortal):
def hola(self):
print('que pasa')
From the module website_invoice_filter_2 I need to import the file generic_functions.py from website_base_filter_2.
This is my try, but Eclipse IDE cannot resolve it.
from Desarrollos.desarollos_backend_HLC_filters.website_base_filter_2.controllers.generic_functions import CustomerPortalFilters
Thanks for reading.
Upvotes: 0
Views: 45
Reputation: 2451
You need to add __init__.py
at the root level in order to use it in the import.
Just create a new empty file named __init__.py
and try again. Basically it will tell the interpreter that it is a python directory so that you can use it in other python files.
Upvotes: 1