Skip to content
Advertisement

How do i import a function from a file in a parent directory

I have a pycharm project with one python file called main.py

on my desktop i have a folder called ‘Python’ inside it looks like this:

JavaScript

In my main file i want to import a function from the framework file. for example if my framework file looks like this:

JavaScript

how would i import the function into my main file?

Advertisement

Answer

in the python structure for import, you should use system layout I mean:

JavaScript

so first of all use init file the simply use import

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement