Explore Courses Blog Tutorials Interview Questions
+3 votes
in Python by (3.4k points)
edited by

How can I import the functions from to another Python file which is in:


from this folder structure:


I've also tried some other methods like one given below, How can I perform this task?

from import func_name

2 Answers

0 votes
by (2k points)
edited by

Use sys.path function:

import sys
sys.path.insert(0, '/path/to/app/app1/xyz')

import file

There are several other methods too but I find this one more easy and efficient. To know more click here.

0 votes
by (106k points)
edited by

Actually, you are doing right just make sure the folder that you want to import must contain an, this allows it to be included as a package.

from import func_name

You can use the following video tutorials to clear all your doubts:-

Related questions

0 votes
2 answers
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jun 26, 2019 in Python by Anurag (33.1k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

29.3k questions

30.6k answers


104k users

Browse Categories