How can I use external Python script in paraview&

Hello everybody!What is a correct way to execute some external python script from disk? Iuse
execfile(‘full_path/script.py’) , but see ‘execfile is not found’. Where is a mistake? Where is a documentation
about that? Please help!

exec(open("./filename").read())

See: What is an alternative to execfile in Python 3? - Stack Overflow

1 Like

Thank you for your answer! I used “exec” but now it does not work because " “self” is not defined". Meanwhile I run using copy-paste it works!

Check the exec documentation:

https://docs.python.org/release/3.2.3/library/functions.html#exec

You have 2 more arguments that can be used to pass global and local variables