0

I have project:

/app
     main.py
     __init__.py
    /directory1
        a.py
        b.py
        __init__.py

    /directory2
        c.py
        d.py
        __init__.py

/x - folder x

This is my code in order to import

from directory2 import c
new_var = c.variable

If it's important, I'am using FastApi And I need variable from directory2, c.py file import to main.py. What should I do? I would need a clear answer: do this (and it will work). Thank you in advice!

An Error: File "C:\Users\Admin\PycharmProjects\app\main.py", line 3, in from directory2 import c

janluk
  • 33
  • 3
  • Does this answer your question? [Importing files from different folder](https://stackoverflow.com/questions/4383571/importing-files-from-different-folder) – ms12 Dec 14 '22 at 20:34
  • No ;/ because I am working with other people on this project – janluk Dec 14 '22 at 20:36
  • In main.py you write: from directory2.c import my_variable print(my_variable) – Alankrith G Dec 14 '22 at 20:49

0 Answers0