If a Python module X is licensed under GPL and a Python script or module Y imports X, does it make Y necessarily GPL also?

2 Answers 2


Yes eventually the GPL flows to the calling/importing code at runtime. At rest the import statement has no impact per se.

  • 1
    This suggests that a non-author, can impose the GPL licence on any arbitrary code, by creating a GPL implementation of a dynamically linked library. I don't think the law would agree. Nov 17, 2020 at 18:13
  • @ctrl-alt-delor: You also asked that on my question. It does not suggest that at all, and I have no clue why you think that. You didn't answer it before, so my guess is you're just making things up? Phillipe's answer is right, under the assumption that OP wants to publish/distribute his python script. If he doesn't, he has no obligations whatsoever.
    – Opifex
    Nov 18, 2020 at 21:35
  • @Opifex it is only a 3rd party (the user of the program), that can deride whether to use a GPLed version of X, or a non-GPLed version of X. How can this decision affect the authors code? The author has only included a module name, and used an interface (and use of an interface is not covered by copyright law). Nov 18, 2020 at 22:04
  • The author has imported the GPL code. Not the 3d party (the user).
    – Opifex
    Nov 19, 2020 at 8:22
  • 1
    No the author has typed import abc. It is not possible to determine the licence of what will be imported at this time. It is not even possible to be sure what will be imported. Nov 19, 2020 at 17:07

Nothing makes Y GPL, short of the author of Y licensing it under GPL or a court order requiring them to do so.

Using a GPL code in Y without licensing Y under GPL makes such use illegal. This only affects the author of Y if they explicitly enable such use, e.g. they distribute Y alongside with X, or Y is distributed alone while X is a well-known GPL library one could expect to be installed on a target system. This would not turn Y license into GPL automatically, but it would open the author of Y to lawsuits, and releasing Y under GPL could be one of the possible outcomes. Alternatively, the author of Y could chose to pay damages to their users, retract the non-compliant version of Y and refrain from distributing Y until it is modified in a way to make it compliant.

If Y is distributed with a closed-sourced version of X, there will be no violation even if an open-source version of X exists and users could technically switch to it by altering Y.

  • I am not sure that the user in the last paragraph would be in violation, as they are free to use however they wish. And changing the linkage of Y does not make a derivative work of X. Nov 18, 2020 at 22:08
  • @ctrl-alt-delor You are right, I removed that statement. Nov 19, 2020 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.