Aceconhielo
Aceconhielo

Reputation: 3636

Can't import script from other folder

Anyone knows how to import an entire script from another folder without using os ? specifically I want to import the script utils_database.py in basic_etl.py I tried to use from utils import utils_database in basic_etl.py but it does not work.

Thanks!

Upvotes: 1

Views: 63

Answers (1)

blhsing
blhsing

Reputation: 107095

The root folder of your project is one level up from the utils folder, so you have to include 01.etl as the top-level package, but then 01.etl is not a valid package name as it starts with a number, so you should rename the folder to something like etl first and then do from etl.utils import utils_database in base_etl.py.

Upvotes: 2

Related Questions