May-11-2022, 08:00 PM
Hello,
I have a folder called "Inventory system" and within the "Inventory System" folder I have 2 subfolders: "Databases" and "Functions"
The "Databases" stores my .db files and the "Functions" folder stores all the functions that I call in my main script (My main script is located in the "Inventory System" folder).
I'm wondering if it's possible for my main script to call all those files from those different folders. I know I need an import statement, but where/how do I provide the paths for the folders?
My Main.py import statements:
I have a folder called "Inventory system" and within the "Inventory System" folder I have 2 subfolders: "Databases" and "Functions"
The "Databases" stores my .db files and the "Functions" folder stores all the functions that I call in my main script (My main script is located in the "Inventory System" folder).
I'm wondering if it's possible for my main script to call all those files from those different folders. I know I need an import statement, but where/how do I provide the paths for the folders?
My Main.py import statements:
#----------------------------------------------- from /Databases/UserDatabase import * from /Functions/CreateItemsTable import createDatabase from /Functions/AddInventory import addInventory #---------------------------------------------------------------And how would I connect to the inventory.db since it's in the "Databases" folder and this chunk of code is from one of my Functions (located in the "Functions" folder)
#Connect to the inventory database (inventory.db) connection = sqlite3.connect("inventory.db") cursor = connection.cursor()Thanks in advance.