function inclusion problem

Ian Kelly ian.g.kelly at gmail.com
Tue Feb 10 19:02:35 EST 2015


On Tue, Feb 10, 2015 at 4:38 PM,  <vlyamtsev at gmail.com> wrote:
> I defined function Fatalln in "mydef.py" and it works fine if i call it from "mydef.py", but when i try to call it from "test.py" in the same folder:
> import mydef
> ...
> Fatalln "my test"
> i have NameError: name 'Fatalln' is not defined
> I also tried include('mydef.py') with the same result...
> What is the right syntax?

    import mydef
    mydef.Fatalin("my test")

or

    from mydef import Fatalin
    Fatalin("my test")



More information about the Python-list mailing list