Skip to content Skip to sidebar Skip to footer

Python Files - Import From Each Other

I would like for two of my python files to import some methods from each other. This seems to be giving me import errors. Example: file_A.py: from file_B import do_B_stuff file

Solution 1:

Don't use the names within the other module directly.

file_A.py

import file_B

def something():
    file_B.do_B_stuff

file_B.py

import file_A

def something():
    file_A.do_A_stuff

Post a Comment for "Python Files - Import From Each Other"