Circular import itself isn't a problem--Python will deal with that. Problems arise according to the order in which classes, etc. are loaded from each module and where the required classes are used. As the previous poster mentioned, you can get around this by moving one of the import statements inside a function. You can also move one of the statements to the bottom of the file. Consider two modules:
*bar.py* from foo import Bar Class MyBar: foo_cls = Foo *and foo.py* from bar import MyBar class Foo: def foo(self): return MyBar() This will cause a problem because foo imports from bar, but bar will need foo.Foo because it's referenced at the top level of the MyBar definition. However, you can move the import in foo.py to the bottom, so that bar isn't imported until Foo has been defined. _Nik On 4/11/2013 11:08 AM, bubu...@gmail.com wrote: > Hi all, > > I have a util file, which will do some stuffs and then, update a model > (so i have to import the models in this file). Also, in my models > file, I trigger a post_save signal to call the util file file (so I > have to import this file in the models file). Obviously, I will get a > circle import problem. Therefore, what is the best practices in this > situation ? > -- > You received this message because you are subscribed to the Google > Groups "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.