How do you get auto completion and stuff?

I’m trying to write unreal python in vs code. But I’m just writing blindly… How do you import unreal and get all the auto completion, function list, etc?

I do most of my Python in Atom or other IDEs a little bit more python-happy, but it looks like you can use this to bring Python Autocomplete using Intellisense into VC Code

Thanks but it doesn’t provide auto complete when I’m doing Unreal stuff… Do you have code completion writing Unreal stuff?

I managed to have some level of success with Atom and a stub file generated by Unreal running the python plugin in developer mode. I wrote a pdf (attached) with the steps I have taken. Let me know if you think there are other or better ways to do this.

Hope this helps,

Hello Pf_breton, is there any way to use the stub file generated for PyCharm as well?


In my case, in PyCharm, I simply added the stup into my project directory and then the ‘‘auto complete’’ works.

You can also set it up in PyCharm by adding the Python stub path to the interpreter path (this should technically keep it auto updated if the stub changes in later versions).

Thanks both Zyanim and Alex!
I noticed you don’t get all the autocomplete possible from the python API documentation, If i add them manually in will it work ?
Was thinking populating the unreal stub with stuff I use along the way.


You could add them manually in to the, but version changes could wipe any additions you make. One way to get around this is to create a new python file (for example sake it’s called unreal_custom_autocomplete) and add any additional code in there. Then add the following to the start of

from unreal_custom_autocomplete import *

This way you only need to add that line in every time the stub gets updated.

The stub file is actually the same file we use to generate the online docs, however the version we use for the docs is generated from an editor that has every plugin enabled so that you get a complete set of available code.

The version you get locally will only contain the things are are currently available to your editor based on your set of enabled plugins. It is generated each time the editor starts though, so enabling a new plugin will automatically add the stub for code it :slight_smile:

Hi Jamie,
thanks for the guide and the information.
I am able to use the stub with the IDE however there is still a lot of classes missing and I don’t think it depends on plugins (eg EditorLevelLibrary, StaticMeshActor are missing but I am able to use the via script in the Unreal Editor).
Since having auto completition will be a huge saving of time for many people isn’t there a way to generate the full stub?
As an alternative could you share the full stub that you used to generate the online documentation for the current version?

As a side question related to this: is there any chance to have the interactive interpreter with auto-complete such as the Blender one? I think it’s very useful and powerful to prototype the first draft of a script and the time saving is huge.


@luca.15 Are they actually missing from the stub file, or is the file too big for your IDE to handle? I had to up the parsing limit in PyCharm quite a bit for it to parse that file, and I don’t know whether other IDEs have similar restrictions.

We could ship the version we build the docs from, but then you’d be missing all of your project specific exposed code. You can generate a complete stub (including code for your own project) by running our commandlet (see Engine\Plugins\Experimental\PythonScriptPlugin\SphinxDocs\PythonAPI_docs_readme.txt for information on how to do that). That will also generate a local set of docs from that stub file.

Didn’t expect this one to be replied again… I actually found out about the stub but was only able to generate a small file that provides minimum actual help… Much like Luca.15’s situation I think.

I went to see my stub and it’s a 1000 line 35kb file. And somehow I don’t have that readme text file…

I have the same file generated and the same directory content in my C:\Program Files\Epic Games\UE_4.21\Engine\Plugins\Experimental\PythonScriptPlugin\SphinxDocs

The stub file should go into your project folder, as Intermediate/PythonStub/

I deleted the file Intermediate/PythonStub/ and restarted the engine. I get the file generated but it is only 35Kb as the one obtained by vito0719.
If I understand correctly it should be much bigger, right?
I am using UE 4.21.1. Could I have something wrong with my setup?

I managed to get autocomplete in Pycharm a while ago but as the others, i only have a 35kb file with 1000 lines of code.
This seems to only contains the Native types of the python API…

Also tried in a blank project to enable each and every one plugin…still the same 35kb file

It seems that this was accidentally broken when making some changes to the API export logic. It had been set-up so that the glue code was only exported into the stub when we were generating API documentation. I’ve fixed this in CL# 4757354 (for 4.22).

great news!